File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -374,6 +374,29 @@ def tearDown(self):
374374 self .loop = None
375375 asyncio .set_event_loop_policy (None )
376376
377+ def test_aiter_idempotent (self ):
378+ async def gen ():
379+ yield 1
380+ applied_once = aiter (gen ())
381+ applied_twice = aiter (applied_once )
382+ self .assertIs (applied_once , applied_twice )
383+
384+ def test_aiter_bad_args (self ):
385+ async def gen ():
386+ yield 1
387+ async def call_with_too_few_args ():
388+ await aiter ()
389+ async def call_with_too_many_args ():
390+ await aiter (gen (), 1 )
391+ async def call_with_wrong_type_arg ():
392+ await aiter (1 )
393+ with self .assertRaises (TypeError ):
394+ self .loop .run_until_complete (call_with_too_few_args ())
395+ with self .assertRaises (TypeError ):
396+ self .loop .run_until_complete (call_with_too_many_args ())
397+ with self .assertRaises (TypeError ):
398+ self .loop .run_until_complete (call_with_wrong_type_arg ())
399+
377400 async def to_list (self , gen ):
378401 res = []
379402 async for i in gen :
You can’t perform that action at this time.
0 commit comments