'Test that cancelling a L{Deferred} after it has been errbacked does
not result in a L{defer.CancelledError}.'

def test_cancelAfterErrback(self):

    def cancel(d):
        self.cancellerCallCount += 1
        d.errback(GenericError())
    d = defer.Deferred(canceller=cancel)
    d.addCallbacks(self._callback, self._errback)
    d.errback(GenericError())
    d.cancel()
    self.assertEqual(self.cancellerCallCount, 0)
    self.assertEqual(self.errbackResults.type, GenericError)
    self.assertIsNone(self.callbackResults)
