MCPcopy Index your code
hub / github.com/python/cpython / test_anext_bad_args

Method test_anext_bad_args

Lib/test/test_asyncgen.py:765–783  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

763 self.assertIs(applied_once, applied_twice)
764
765 def test_anext_bad_args(self):
766 async def gen():
767 yield 1
768 async def call_with_too_few_args():
769 await anext()
770 async def call_with_too_many_args():
771 await anext(gen(), 1, 3)
772 async def call_with_wrong_type_args():
773 await anext(1, gen())
774 async def call_with_kwarg():
775 await anext(aiterator=gen())
776 with self.assertRaises(TypeError):
777 self.loop.run_until_complete(call_with_too_few_args())
778 with self.assertRaises(TypeError):
779 self.loop.run_until_complete(call_with_too_many_args())
780 with self.assertRaises(TypeError):
781 self.loop.run_until_complete(call_with_wrong_type_args())
782 with self.assertRaises(TypeError):
783 self.loop.run_until_complete(call_with_kwarg())
784
785 def test_anext_bad_await(self):
786 async def bad_awaitable():

Callers

nothing calls this directly

Calls 2

assertRaisesMethod · 0.45
run_until_completeMethod · 0.45

Tested by

no test coverage detected