@@ -379,7 +379,10 @@ async def async_gen_wrapper():
379379
380380 def test_async_gen_exception_12 (self ):
381381 async def gen ():
382- await anext (me )
382+ with self .assertWarnsRegex (RuntimeWarning ,
383+ f"coroutine method 'asend' of '{ gen .__qualname__ } ' "
384+ f"was never awaited" ):
385+ await anext (me )
383386 yield 123
384387
385388 me = gen ()
@@ -395,7 +398,12 @@ async def gen():
395398 yield 123
396399
397400 with self .assertWarns (DeprecationWarning ):
398- gen ().athrow (GeneratorExit , GeneratorExit (), None )
401+ x = gen ().athrow (GeneratorExit , GeneratorExit (), None )
402+ with self .assertWarnsRegex (RuntimeWarning ,
403+ f"coroutine method 'athrow' of '{ gen .__qualname__ } ' "
404+ f"was never awaited" ):
405+ del x
406+ gc_collect ()
399407
400408 def test_async_gen_api_01 (self ):
401409 async def gen ():
@@ -1564,6 +1572,11 @@ async def main():
15641572 self .assertIsInstance (message ['exception' ], ZeroDivisionError )
15651573 self .assertIn ('unhandled exception during asyncio.run() shutdown' ,
15661574 message ['message' ])
1575+ with self .assertWarnsRegex (RuntimeWarning ,
1576+ f"coroutine method 'aclose' of '{ async_iterate .__qualname__ } ' "
1577+ f"was never awaited" ):
1578+ del message , messages
1579+ gc_collect ()
15671580
15681581 def test_async_gen_expression_01 (self ):
15691582 async def arange (n ):
@@ -1617,6 +1630,10 @@ async def main():
16171630 asyncio .run (main ())
16181631
16191632 self .assertEqual ([], messages )
1633+ with self .assertWarnsRegex (RuntimeWarning ,
1634+ f"coroutine method 'aclose' of '{ async_iterate .__qualname__ } ' "
1635+ f"was never awaited" ):
1636+ gc_collect ()
16201637
16211638 def test_async_gen_await_same_anext_coro_twice (self ):
16221639 async def async_iterate ():
0 commit comments