(self)
| 65 | cls(loop=loop) |
| 66 | |
| 67 | async def test_lock_by_with_statement(self): |
| 68 | primitives = [ |
| 69 | asyncio.Lock(), |
| 70 | asyncio.Condition(), |
| 71 | asyncio.Semaphore(), |
| 72 | asyncio.BoundedSemaphore(), |
| 73 | ] |
| 74 | |
| 75 | for lock in primitives: |
| 76 | await asyncio.sleep(0.01) |
| 77 | self.assertFalse(lock.locked()) |
| 78 | with self.assertRaisesRegex( |
| 79 | TypeError, |
| 80 | r"'\w+' object can't be awaited" |
| 81 | ): |
| 82 | with await lock: |
| 83 | pass |
| 84 | self.assertFalse(lock.locked()) |
| 85 | |
| 86 | async def test_acquire(self): |
| 87 | lock = asyncio.Lock() |
nothing calls this directly
no test coverage detected