MCPcopy Index your code
hub / github.com/RustPython/RustPython / test6

Method test6

Lib/test/test_asyncgen.py:939–952  ·  view source on GitHub ↗
(anext)

Source from the content-addressed store, hash-verified

937 g.throw(MyError())
938
939 def test6(anext):
940 @types.coroutine
941 def _async_yield(v):
942 yield v * 10
943 return (yield (v * 10 + 1))
944
945 async def agenfn():
946 await _async_yield(1)
947 yield 'aaa'
948
949 agen = agenfn()
950 with contextlib.closing(anext(agen, "default").__await__()) as g:
951 with self.assertRaises(MyError):
952 g.throw(MyError())
953
954 def run_test(test):
955 with self.subTest('pure-Python anext()'):

Callers

nothing calls this directly

Calls 6

anextFunction · 0.85
closingMethod · 0.80
MyErrorClass · 0.70
__await__Method · 0.45
assertRaisesMethod · 0.45
throwMethod · 0.45

Tested by

no test coverage detected