本文整理汇总了Python中celery.worker.hub.Hub.writers方法的典型用法代码示例。如果您正苦于以下问题:Python Hub.writers方法的具体用法?Python Hub.writers怎么用?Python Hub.writers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类celery.worker.hub.Hub
的用法示例。
在下文中一共展示了Hub.writers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_repr_events
# 需要导入模块: from celery.worker.hub import Hub [as 别名]
# 或者: from celery.worker.hub.Hub import writers [as 别名]
def test_repr_events(self):
hub = Hub()
hub.readers = {6: Mock(), 7: Mock(), 8: Mock()}
hub.writers = {9: Mock()}
for value in list(hub.readers.values()) + list(hub.writers.values()):
value.__name__ = "mock"
self.assertTrue(hub.repr_events([(6, READ), (7, ERR), (8, READ | ERR), (9, WRITE), (10, 13213)]))
示例2: test_repr_active
# 需要导入模块: from celery.worker.hub import Hub [as 别名]
# 或者: from celery.worker.hub.Hub import writers [as 别名]
def test_repr_active(self):
hub = Hub()
hub.readers = {1: Mock(), 2: Mock()}
hub.writers = {3: Mock(), 4: Mock()}
for value in list(hub.readers.values()) + list(hub.writers.values()):
value.__name__ = "mock"
self.assertTrue(hub.repr_active())
示例3: test_callback_for
# 需要导入模块: from celery.worker.hub import Hub [as 别名]
# 或者: from celery.worker.hub.Hub import writers [as 别名]
def test_callback_for(self):
hub = Hub()
reader, writer = Mock(), Mock()
hub.readers = {6: reader}
hub.writers = {7: writer}
self.assertEqual(hub._callback_for(6, READ), reader)
self.assertEqual(hub._callback_for(7, WRITE), writer)
with self.assertRaises(KeyError):
hub._callback_for(6, WRITE)
self.assertEqual(hub._callback_for(6, WRITE, "foo"), "foo")