'The L{defer.Deferred} errbacks with the failure if it fails before the
timeout. No cancellation happens after the errback either, which
could also cancel inner deferreds.'

def test_failureBeforeTimeout(self):

    clock = Clock()
    d = defer.Deferred()
    d.addTimeout(10, clock)
    innerDeferred = defer.Deferred()
    dErrbacked = [None]
    error = ValueError('fail')
    def onErrback(f):
        dErrbacked[0] = f
        return innerDeferred
    d.addErrback(onErrback)
    d.errback(error)
    self.assertIsInstance(dErrbacked[0], failure.Failure)
    self.assertIs(dErrbacked[0].value, error)
    clock.advance(15)
    self.assertNoResult(innerDeferred)
