本文整理汇总了Python中celery.events.snapshot.Polaroid类的典型用法代码示例。如果您正苦于以下问题:Python Polaroid类的具体用法?Python Polaroid怎么用?Python Polaroid使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Polaroid类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_cleanup
def test_cleanup(self):
x = Polaroid(self.state, app=self.app)
cleanup_signal_sent = [False]
def handler(**kwargs):
cleanup_signal_sent[0] = True
x.cleanup_signal.connect(handler)
x.cleanup()
assert cleanup_signal_sent[0]
示例2: test_shutter_maxrate
def test_shutter_maxrate(self):
x = Polaroid(self.state, app=self.app, maxrate='1/h')
shutter_signal_sent = [0]
def handler(**kwargs):
shutter_signal_sent[0] += 1
x.shutter_signal.connect(handler)
for i in range(30):
x.shutter()
x.shutter()
x.shutter()
assert shutter_signal_sent[0] == 1
示例3: test_shutter__capture
def test_shutter__capture(self):
x = Polaroid(self.state, app=self.app)
shutter_signal_sent = [False]
def handler(**kwargs):
shutter_signal_sent[0] = True
x.shutter_signal.connect(handler)
x.shutter()
assert shutter_signal_sent[0]
shutter_signal_sent[0] = False
x.capture()
assert shutter_signal_sent[0]
示例4: test_install_timers
def test_install_timers(self):
x = Polaroid(self.state, app=self.app)
x.timer = timer
x.__exit__()
x.__enter__()
assert x.capture in MockTimer.installed
assert x.cleanup in MockTimer.installed
x._tref.cancel.assert_not_called()
x._ctref.cancel.assert_not_called()
x.__exit__()
x._tref.cancel.assert_called()
x._ctref.cancel.assert_called()
x._tref.assert_called()
x._ctref.assert_not_called()
示例5: test_install_timers
def test_install_timers(self):
x = Polaroid(self.state, app=self.app)
x.timer = timer
x.__exit__()
x.__enter__()
self.assertIn(x.capture, MockTimer.installed)
self.assertIn(x.cleanup, MockTimer.installed)
self.assertTrue(x._tref.active)
self.assertTrue(x._ctref.active)
x.__exit__()
self.assertFalse(x._tref.active)
self.assertFalse(x._ctref.active)
self.assertTrue(x._tref.called)
self.assertFalse(x._ctref.called)
示例6: __init__
def __init__(self, state, freq=1.0):
Polaroid.__init__(self, state, freq)