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