Closed bezruc closed 2 months ago
As title says.
FakeAIOKafkaConsumer returns:
def subscription(self) -> list[str]: return self.subscribed_topic
While AIOKafkaConsumer returns:
def subscription(self): """ Get the current topics subscription. Returns: frozenset(str): a set of topics """ return self._subscription.topics
This results in unability to check mock subscription sets using set operators.
Eg.
def subscribe_to(self, topics: set[str]): new_sub = self._consumer.subscription() | topics self._consumer.subscribe(new_sub)
Will fail, even though it should work on original consumer.
Edit: links for convenience AIOKafka - https://github.com/aio-libs/aiokafka/blob/e2afc034b59626242b51b06b30a62c565ef491d9/aiokafka/consumer/consumer.py#L1103C9-L1103C21 FakeAIOKafka - https://github.com/alm0ra/mockafka-py/blob/4c1b5eaf762b7b9900928c33e424be413a7589e2/mockafka/aiokafka/aiokafka_consumer.py#L154C1-L156C1
Good spot, thanks for reporting. I've put up a fix in #140 (along with a fix for a similar issue on another method).
As title says.
FakeAIOKafkaConsumer returns:
While AIOKafkaConsumer returns:
This results in unability to check mock subscription sets using set operators.
Eg.
Will fail, even though it should work on original consumer.
Edit: links for convenience AIOKafka - https://github.com/aio-libs/aiokafka/blob/e2afc034b59626242b51b06b30a62c565ef491d9/aiokafka/consumer/consumer.py#L1103C9-L1103C21 FakeAIOKafka - https://github.com/alm0ra/mockafka-py/blob/4c1b5eaf762b7b9900928c33e424be413a7589e2/mockafka/aiokafka/aiokafka_consumer.py#L154C1-L156C1