'An errback added before a timeout is added with a custom
timeout function errbacks with a L{defer.CancelledError} when
the timeout fires.  The timeout function runs if the errback
returns the L{defer.CancelledError}.'

def test_errbackAddedBeforeTimeoutCustom(self):

    clock = Clock()
    d = defer.Deferred()
    dErrbacked = [None]
    def errback(f):
        dErrbacked[0] = f
        return f
    d.addErrback(errback)
    d.addTimeout(10, clock, _overrideFunc)
    clock.advance(15)
    self.assertIsInstance(dErrbacked[0], failure.Failure)
    self.assertIsInstance(dErrbacked[0].value, defer.CancelledError)
    self.assertEqual('OVERRIDDEN', self.successResultOf(d))
