tests: Add testcase for yielding from a stopped generator.

gc_dump_improvements
Paul Sokolovsky 2016-04-28 02:07:42 +03:00
parent eff85bb1dc
commit 0ea2108f1c
1 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,18 @@
# Yielding from stopped generator is ok and results in None
def gen():
return 1
# This yield is just to make this a generator
yield
f = gen()
def run():
print((yield from f))
print((yield from f))
print((yield from f))
try:
next(run())
except StopIteration:
print("StopIteration")