Skip to content

Commit 0ea2108

Browse files
committed
tests: Add testcase for yielding from a stopped generator.
1 parent eff85bb commit 0ea2108

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Yielding from stopped generator is ok and results in None
2+
3+
def gen():
4+
return 1
5+
# This yield is just to make this a generator
6+
yield
7+
8+
f = gen()
9+
10+
def run():
11+
print((yield from f))
12+
print((yield from f))
13+
print((yield from f))
14+
15+
try:
16+
next(run())
17+
except StopIteration:
18+
print("StopIteration")

0 commit comments

Comments
 (0)