'Test that cancelling a DelayedCall after it has run its function
raises the appropriate exception.'

def test_cancelCalledDelayedCallAsynchronous(self):

    d = Deferred()
    def check():
        try:
            self.assertRaises(error.AlreadyCalled, call.cancel)
        except:
            d.errback()
        else:
            d.callback(None)
    def later():
        reactor.callLater(0, check)
    call = reactor.callLater(0, later)
    return d
