本文整理汇总了Python中aiokafka.client.AIOKafkaClient.__repr__方法的典型用法代码示例。如果您正苦于以下问题:Python AIOKafkaClient.__repr__方法的具体用法?Python AIOKafkaClient.__repr__怎么用?Python AIOKafkaClient.__repr__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aiokafka.client.AIOKafkaClient
的用法示例。
在下文中一共展示了AIOKafkaClient.__repr__方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_init_with_list
# 需要导入模块: from aiokafka.client import AIOKafkaClient [as 别名]
# 或者: from aiokafka.client.AIOKafkaClient import __repr__ [as 别名]
def test_init_with_list(self):
client = AIOKafkaClient(
loop=self.loop,
bootstrap_servers=['kafka01:9092', 'kafka02:9092', 'kafka03:9092'])
self.assertEqual(
'<AIOKafkaClient client_id=aiokafka-0.0.1>', client.__repr__())
self.assertEqual(sorted({'kafka01': 9092,
'kafka02': 9092,
'kafka03': 9092}.items()),
sorted(client.hosts))
node = client.get_random_node()
self.assertEqual(node, None) # unknown cluster metadata
示例2: test_init_with_list
# 需要导入模块: from aiokafka.client import AIOKafkaClient [as 别名]
# 或者: from aiokafka.client.AIOKafkaClient import __repr__ [as 别名]
def test_init_with_list(self):
client = AIOKafkaClient(
loop=self.loop, bootstrap_servers=[
'127.0.0.1:9092', '127.0.0.2:9092', '127.0.0.3:9092'])
self.assertEqual(
'<AIOKafkaClient client_id=aiokafka-0.1.2>', client.__repr__())
self.assertEqual(
sorted([('127.0.0.1', 9092, socket.AF_INET),
('127.0.0.2', 9092, socket.AF_INET),
('127.0.0.3', 9092, socket.AF_INET)]),
sorted(client.hosts))
node = client.get_random_node()
self.assertEqual(node, None) # unknown cluster metadata
示例3: test_init_with_list
# 需要导入模块: from aiokafka.client import AIOKafkaClient [as 别名]
# 或者: from aiokafka.client.AIOKafkaClient import __repr__ [as 别名]
def test_init_with_list(self):
client = AIOKafkaClient(["kafka01:9092", "kafka02:9092", "kafka03:9092"], loop=self.loop)
self.assertTrue("KafkaClient" in client.__repr__())
self.assertEqual(sorted({"kafka01": 9092, "kafka02": 9092, "kafka03": 9092}.items()), sorted(client.hosts))