(anext)
| 937 | g.throw(MyError()) |
| 938 | |
| 939 | def test6(anext): |
| 940 | @types.coroutine |
| 941 | def _async_yield(v): |
| 942 | yield v * 10 |
| 943 | return (yield (v * 10 + 1)) |
| 944 | |
| 945 | async def agenfn(): |
| 946 | await _async_yield(1) |
| 947 | yield 'aaa' |
| 948 | |
| 949 | agen = agenfn() |
| 950 | with contextlib.closing(anext(agen, "default").__await__()) as g: |
| 951 | with self.assertRaises(MyError): |
| 952 | g.throw(MyError()) |
| 953 | |
| 954 | def run_test(test): |
| 955 | with self.subTest('pure-Python anext()'): |