示例#1
0
 def test_cancel(self):
     x = Timer()
     tref = Mock(name='tref')
     x.cancel(tref)
     tref.cancel.assert_called_with()
     x.GreenletExit = KeyError
     tref.cancel.side_effect = KeyError()
     x.cancel(tref)
示例#2
0
 def test_cancel(self):
     x = Timer()
     tref = Mock(name='tref')
     x.cancel(tref)
     tref.cancel.assert_called_with()
     x.GreenletExit = KeyError
     tref.cancel.side_effect = KeyError()
     x.cancel(tref)
示例#3
0
    def test_timer(self):
        x = Timer()
        x.ensure_started()
        x.schedule = Mock()
        x.start()
        x.stop()
        x.schedule.clear.assert_called_with()

        tref = Mock()
        x.cancel(tref)
        x.schedule.GreenletExit = KeyError
        tref.cancel.side_effect = KeyError()
        x.cancel(tref)