def test_providedCancelCalledBeforeTimeoutCustom(self):
        """
        A custom translation function can handle a L{defer.Deferred} with a
        custom cancellation function.
        """
        clock = Clock()
        d = defer.Deferred(lambda c: c.errback(ValueError('what!')))
        d.addTimeout(10, clock, onTimeoutCancel=_overrideFunc)
        self.assertNoResult(d)

        clock.advance(15)

        self.assertEqual("OVERRIDDEN", self.successResultOf(d))

        A custom translation function can handle a L{defer.Deferred} with a
        custom cancellation function.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_defer.py