MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_repr_count

Method test_repr_count

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

reprFunction · 0.85
assertInMethod · 0.80
BunchClass · 0.70
acquireMethod · 0.45

Tested by

no test coverage detected