[pypy-commit] pypy py3.6: add failing test for yielding a StopIteration from an asyncgen
raduciorba
pypy.commits at gmail.com
Sun Jul 29 11:44:26 EDT 2018
Author: Radu Ciorba <radu at 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())
+ """
More information about the pypy-commit
mailing list