'Given a deferred with a cancellation function that resumes the
callback chain, a callback that is added to the deferred
before a timeout is added to runs when the timeout fires.  The
deferred completes successfully, without a
L{defer.TimeoutError}.'

def test_callbackAddedToCancelerBeforeTimeout(self):

    clock = Clock()
    success = 'success'
    d = defer.Deferred((lambda d: d.callback(success)))
    dCallbacked = [None]
    def callback(value):
        dCallbacked[0] = value
        return value
    d.addCallback(callback)
    d.addTimeout(10, clock)
    clock.advance(15)
    self.assertEqual(dCallbacked[0], success)
    self.assertIs(success, self.successResultOf(d))
