本文整理匯總了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))