(self)
| 622 | self.assertTrue(t3.result()) |
| 623 | |
| 624 | async def test_notify_all(self): |
| 625 | cond = asyncio.Condition() |
| 626 | |
| 627 | result = [] |
| 628 | |
| 629 | async def c1(result): |
| 630 | await cond.acquire() |
| 631 | if await cond.wait(): |
| 632 | result.append(1) |
| 633 | cond.release() |
| 634 | return True |
| 635 | |
| 636 | async def c2(result): |
| 637 | await cond.acquire() |
| 638 | if await cond.wait(): |
| 639 | result.append(2) |
| 640 | cond.release() |
| 641 | return True |
| 642 | |
| 643 | t1 = asyncio.create_task(c1(result)) |
| 644 | t2 = asyncio.create_task(c2(result)) |
| 645 | |
| 646 | await asyncio.sleep(0) |
| 647 | self.assertEqual([], result) |
| 648 | |
| 649 | await cond.acquire() |
| 650 | cond.notify_all() |
| 651 | cond.release() |
| 652 | await asyncio.sleep(0) |
| 653 | self.assertEqual([1, 2], result) |
| 654 | |
| 655 | self.assertTrue(t1.done()) |
| 656 | self.assertTrue(t1.result()) |
| 657 | self.assertTrue(t2.done()) |
| 658 | self.assertTrue(t2.result()) |
| 659 | |
| 660 | def test_notify_unacquired(self): |
| 661 | cond = asyncio.Condition() |
nothing calls this directly
no test coverage detected