'If the deferred is failed before the timeout, the timeout is not still
pending on the reactor.'

def test_timeout_cleaned_up_on_failure(self):

    timeout(self.clock, self.deferred, self.timeout)
    self.deferred.errback(CustomException(self.id()))
    self.addCleanup(self.deferred.addErrback, (lambda _: None))
    self.assertEqual(self.clock.getDelayedCalls(), [])
