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

Method test_repr_count

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

Source from the content-addressed store, hash-verified

338 Tests for recursive locks.
339 """
340 def test_repr_count(self):
341 # see gh-134322: check that count values are correct:
342 # when a rlock is just created,
343 # in a second thread when rlock is acquired in the main thread.
344 lock = self.locktype()
345 self.assertIn("count=0", repr(lock))
346 self.assertIn("<unlocked", repr(lock))
347 lock.acquire()
348 lock.acquire()
349 self.assertIn("count=2", repr(lock))
350 self.assertIn("<locked", repr(lock))
351
352 result = []
353 def call_repr():
354 result.append(repr(lock))
355 with Bunch(call_repr, 1):
356 pass
357 self.assertIn("count=2", result[0])
358 self.assertIn("<locked", result[0])
359
360 def test_reacquire(self):
361 lock = self.locktype()

Callers

nothing calls this directly

Calls 3

assertInMethod · 0.80
BunchClass · 0.70
acquireMethod · 0.45

Tested by

no test coverage detected