def test_cancel_already_called(self): # Verify that the timer gracefully handles AlreadyCalled errors. self.handle.cancel.side_effect = twisted_error.AlreadyCalled() self.timer.cancel() self.handle.cancel.assert_called_once()
def _check(self): if self.called: raise error.AlreadyCalled() elif self.cancelled: raise error.AlreadyCancelled()