| 378 | self.compare_generators(sync_gen_wrapper(), async_gen_wrapper()) |
| 379 | |
| 380 | def test_async_gen_exception_12(self): |
| 381 | async def gen(): |
| 382 | with self.assertWarnsRegex(RuntimeWarning, |
| 383 | f"coroutine method 'asend' of '{gen.__qualname__}' " |
| 384 | f"was never awaited"): |
| 385 | await anext(me) |
| 386 | yield 123 |
| 387 | |
| 388 | me = gen() |
| 389 | ai = me.__aiter__() |
| 390 | an = ai.__anext__() |
| 391 | |
| 392 | with self.assertRaisesRegex(RuntimeError, |
| 393 | r'anext\(\): asynchronous generator is already running'): |
| 394 | an.__next__() |
| 395 | |
| 396 | with self.assertRaisesRegex(RuntimeError, |
| 397 | r"cannot reuse already awaited __anext__\(\)/asend\(\)"): |
| 398 | an.send(None) |
| 399 | |
| 400 | def test_async_gen_asend_throw_concurrent_with_send(self): |
| 401 | import types |