def testD(self): lock = Lock() lock.acquire() lock.release() fut = lock.acquire() assert fut.done()
def testReleasingUnlockedLockRaises(self): lock = Lock() with pytest.raises(RuntimeError): lock.release()
def testSecondAcquireBlocks(self): lock = Lock() lock.acquire() fut = lock.acquire() assert not fut.done()
def testFirstAcquirePasses(self): lock = Lock() fut = lock.acquire() assert fut.done()
def testE(self): lock = Lock() lock.acquire() f1 = lock.acquire() assert not f1.done() lock.release() f2 = lock.acquire() assert not f2.done() lock.release() assert f1.done() lock.release() assert f2.done()