22import asyncio
33import trio
44import sniffio
5- from async_generator import async_generator , yield_
65from trio_asyncio import aio_as_trio , trio_as_aio
76from tests import aiotest
87from functools import partial
@@ -526,23 +525,21 @@ def err_asyncio():
526525
527526 @pytest .mark .trio
528527 async def test_trio_asyncio_generator (self , loop ):
529- @async_generator
530528 async def dly_asyncio ():
531- await yield_ ( 1 )
529+ yield 1
532530 await asyncio .sleep (0.01 , loop = loop )
533- await yield_ ( 2 )
531+ yield 2
534532
535533 with test_utils .deprecate (self ):
536534 res = await async_gen_to_list (loop .wrap_generator (dly_asyncio ))
537535 assert res == [1 , 2 ]
538536
539537 @pytest .mark .trio
540538 async def test_trio_asyncio_generator_with_error (self , loop ):
541- @async_generator
542539 async def dly_asyncio ():
543- await yield_ ( 1 )
540+ yield 1
544541 raise RuntimeError ("I has an owie" )
545- await yield_ ( 2 )
542+ yield 2
546543
547544 with test_utils .deprecate (self ):
548545 with pytest .raises (RuntimeError ) as err :
@@ -551,9 +548,8 @@ async def dly_asyncio():
551548
552549 @pytest .mark .trio
553550 async def test_trio_asyncio_generator_with_cancellation (self , loop ):
554- @async_generator
555551 async def dly_asyncio (hold , seen ):
556- await yield_ ( 1 )
552+ yield 1
557553 seen .flag |= 1
558554 await hold .wait ()
559555
@@ -573,11 +569,10 @@ async def cancel_soon(nursery):
573569
574570 @pytest .mark .trio
575571 async def test_trio_asyncio_iterator (self , loop ):
576- @async_generator
577572 async def slow_nums ():
578573 for n in range (1 , 6 ):
579574 await asyncio .sleep (0.01 , loop = loop )
580- await yield_ ( n )
575+ yield n
581576
582577 sum = 0
583578 async for n in aio_as_trio (slow_nums ()):
@@ -586,11 +581,10 @@ async def slow_nums():
586581
587582 @pytest .mark .trio
588583 async def test_trio_asyncio_iterator_depr (self , loop ):
589- @async_generator
590584 async def slow_nums ():
591585 for n in range (1 , 6 ):
592586 await asyncio .sleep (0.01 , loop = loop )
593- await yield_ ( n )
587+ yield n
594588
595589 sum = 0
596590 # with test_utils.deprecate(self): ## not yet
0 commit comments