| 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() |