circuitpython/tests/basics/gen_yield_from_stopped.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
317 B
Python
Raw Normal View History

# 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")