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)
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)