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

Method test_locked

Lib/test/lock_tests.py:381–391  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

379 self.assertRaises(RuntimeError, lock.release)
380
381 def test_locked(self):
382 lock = self.locktype()
383 self.assertFalse(lock.locked())
384 lock.acquire()
385 self.assertTrue(lock.locked())
386 lock.acquire()
387 self.assertTrue(lock.locked())
388 lock.release()
389 self.assertTrue(lock.locked())
390 lock.release()
391 self.assertFalse(lock.locked())
392
393 def test_locked_with_2threads(self):
394 # see gh-134323: check that a rlock which

Callers

nothing calls this directly

Calls 5

assertFalseMethod · 0.80
assertTrueMethod · 0.80
lockedMethod · 0.45
acquireMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected