(self)
| 682 | support.gc_collect() |
| 683 | |
| 684 | def test_func_10(self): |
| 685 | N = 0 |
| 686 | |
| 687 | @types.coroutine |
| 688 | def gen(): |
| 689 | nonlocal N |
| 690 | try: |
| 691 | a = yield |
| 692 | yield (a ** 2) |
| 693 | except ZeroDivisionError: |
| 694 | N += 100 |
| 695 | raise |
| 696 | finally: |
| 697 | N += 1 |
| 698 | |
| 699 | async def foo(): |
| 700 | await gen() |
| 701 | |
| 702 | coro = foo() |
| 703 | aw = coro.__await__() |
| 704 | self.assertIs(aw, iter(aw)) |
| 705 | next(aw) |
| 706 | self.assertEqual(aw.send(10), 100) |
| 707 | |
| 708 | self.assertEqual(N, 0) |
| 709 | aw.close() |
| 710 | self.assertEqual(N, 1) |
| 711 | |
| 712 | coro = foo() |
| 713 | aw = coro.__await__() |
| 714 | next(aw) |
| 715 | with self.assertRaises(ZeroDivisionError): |
| 716 | aw.throw(ZeroDivisionError()) |
| 717 | self.assertEqual(N, 102) |
| 718 | |
| 719 | coro = foo() |
| 720 | aw = coro.__await__() |
| 721 | next(aw) |
| 722 | with self.assertRaises(ZeroDivisionError): |
| 723 | with self.assertWarns(DeprecationWarning): |
| 724 | aw.throw(ZeroDivisionError, ZeroDivisionError(), None) |
| 725 | |
| 726 | def test_func_11(self): |
| 727 | async def func(): pass |
nothing calls this directly
no test coverage detected