'When canceling a L{Deferred} from a L{DeferredQueue} that does not
have a result (i.e., the L{Deferred} has not fired), the cancel
causes a L{defer.CancelledError} failure. If the queue has a result
later on, it doesn\'t try to fire the deferred.'

def test_cancelQueueAfterGet(self):

    queue = defer.DeferredQueue()
    d = queue.get()
    d.cancel()
    self.assertImmediateFailure(d, defer.CancelledError)
    def cb(ignore):
        queue.put(None)
        return queue.get().addCallback(self.assertIs, None)
    d.addCallback(cb)
    done = []
    d.addCallback(done.append)
    self.assertEqual(len(done), 1)
