本文整理汇总了Python中kafka.future.Future.value方法的典型用法代码示例。如果您正苦于以下问题:Python Future.value方法的具体用法?Python Future.value怎么用?Python Future.value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kafka.future.Future
的用法示例。
在下文中一共展示了Future.value方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_process_queue_success_cb
# 需要导入模块: from kafka.future import Future [as 别名]
# 或者: from kafka.future.Future import value [as 别名]
def test_process_queue_success_cb(self):
""" Verify success callback executed on Future success"""
mock_future = Future()
mock_future.is_done = True
mock_future.value = 1
self.kafka_producer.send = MagicMock(return_value=mock_future)
with self.assertRaises(SuccessException) as context:
process_queue(self.event_queue,
"test",
self.kafka_producer,
self.success_cb,
self.error_cb)
示例2: test_process_queue
# 需要导入模块: from kafka.future import Future [as 别名]
# 或者: from kafka.future.Future import value [as 别名]
def test_process_queue(self):
""" Verify message queue is processed."""
mock_future = Future()
mock_future.is_done = True
mock_future.value = 1
self.kafka_producer.send = MagicMock(return_value=mock_future)
with self.assertRaises(SuccessException) as context:
process_queue(self.event_queue,
"test",
self.kafka_producer,
self.success_cb,
self.error_cb)
# Verify message queue "get" is called
self.event_queue.get.assert_called_with()