'Verify that a Deferred, a, which is waiting on another Deferred, b,
returned from one of its callbacks, will propagate
L{defer.CancelledError} when a is cancelled.'

def test_cancelNestedDeferred(self):

    def innerCancel(d):
        self.cancellerCallCount += 1
    def cancel(d):
        self.assertTrue(False)
    b = defer.Deferred(canceller=innerCancel)
    a = defer.Deferred(canceller=cancel)
    a.callback(None)
    a.addCallback((lambda data: b))
    a.cancel()
    a.addCallbacks(self._callback, self._errback)
    self.assertEqual(self.cancellerCallCount, 1)
    self.assertEqual(self.errbackResults.type, defer.CancelledError)
