'Test that cancelling a deferred after it has been callbacked does
not cause an error.'

def test_cancelAfterCallback(self):

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