当前位置: 首页>>代码示例>>Python>>正文


Python snapshot.Polaroid类代码示例

本文整理汇总了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]
开发者ID:bryson,项目名称:celery,代码行数:10,代码来源:test_snapshot.py

示例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
开发者ID:bryson,项目名称:celery,代码行数:13,代码来源:test_snapshot.py

示例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]
开发者ID:bryson,项目名称:celery,代码行数:14,代码来源:test_snapshot.py

示例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()
开发者ID:bryson,项目名称:celery,代码行数:14,代码来源:test_snapshot.py

示例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)
开发者ID:imankulov,项目名称:celery,代码行数:14,代码来源:test_snapshot.py

示例6: __init__

 def __init__(self, state, freq=1.0):
     Polaroid.__init__(self, state, freq)
开发者ID:MechanisM,项目名称:flower,代码行数:2,代码来源:events.py


注:本文中的celery.events.snapshot.Polaroid类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。