(anext)
| 897 | self.assertEqual(g.send(None), 1) |
| 898 | |
| 899 | def test4(anext): |
| 900 | @types.coroutine |
| 901 | def _async_yield(v): |
| 902 | yield v * 10 |
| 903 | return (yield (v * 10 + 1)) |
| 904 | |
| 905 | async def agenfn(): |
| 906 | try: |
| 907 | await _async_yield(1) |
| 908 | except MyError: |
| 909 | await _async_yield(2) |
| 910 | return |
| 911 | yield |
| 912 | |
| 913 | agen = agenfn() |
| 914 | with contextlib.closing(anext(agen, "default").__await__()) as g: |
| 915 | self.assertEqual(g.send(None), 10) |
| 916 | self.assertEqual(g.throw(MyError()), 20) |
| 917 | with self.assertRaisesRegex(MyError, 'val'): |
| 918 | g.throw(MyError('val')) |
| 919 | |
| 920 | def test5(anext): |
| 921 | @types.coroutine |
nothing calls this directly
no test coverage detected