MCPcopy Index your code
hub / github.com/python/cpython / testWithSemaphore

Method testWithSemaphore

Lib/test/test_contextlib.py:487–495  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

485 self.boilerPlate(lock, locked)
486
487 def testWithSemaphore(self):
488 lock = threading.Semaphore()
489 def locked():
490 if lock.acquire(False):
491 lock.release()
492 return False
493 else:
494 return True
495 self.boilerPlate(lock, locked)
496
497 def testWithBoundedSemaphore(self):
498 lock = threading.BoundedSemaphore()

Callers

nothing calls this directly

Calls 2

boilerPlateMethod · 0.95
SemaphoreMethod · 0.80

Tested by

no test coverage detected