def test_cancelLockBeforeAcquired(self):
"""
When canceling a L{Deferred} from a L{DeferredLock} that does not
yet have the lock (i.e., the L{Deferred} has not fired), the cancel
should cause a L{defer.CancelledError} failure.
"""
lock = defer.DeferredLock()
lock.acquire()
d = lock.acquire()
d.cancel()
self.assertImmediateFailure(d, defer.CancelledError)
评论列表
文章目录