Author: Radu Ciorba <r...@devrandom.ro> Branch: py3.6 Changeset: r94929:d890ba3db546 Date: 2018-07-29 16:49 +0300 http://bitbucket.org/pypy/pypy/changeset/d890ba3db546/
Log: add failing test for yielding a StopIteration from an asyncgen diff --git a/pypy/interpreter/test/test_coroutine.py b/pypy/interpreter/test/test_coroutine.py --- a/pypy/interpreter/test/test_coroutine.py +++ b/pypy/interpreter/test/test_coroutine.py @@ -671,3 +671,20 @@ assert self.run_async(run()) == ([], (1,)) """ + + def test_asyncgen_yield_stopiteration(self): + """ + async def foo(): + yield 1 + yield StopIteration(2) + + async def run(): + it = foo().__aiter__() + val1 = await it.__anext__() + assert val1 == 1 + val2 = await it.__anext__() + assert isinstance(val2, StopIteration) + assert val2.value == 2 + + self.run_async(run()) + """ _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit