tests/stress/recursive_gen: Add test for recursive gen with iter.
This commit is contained in:
parent
22f1414abb
commit
605fdcf754
@ -1,9 +1,18 @@
|
|||||||
# test deeply recursive generators
|
# test deeply recursive generators
|
||||||
|
|
||||||
|
# simple "yield from" recursion
|
||||||
def gen():
|
def gen():
|
||||||
yield from gen()
|
yield from gen()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
list(gen())
|
list(gen())
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
print('RuntimeError')
|
print('RuntimeError')
|
||||||
|
|
||||||
|
# recursion via an iterator over a generator
|
||||||
|
def gen2():
|
||||||
|
for x in gen2():
|
||||||
|
yield x
|
||||||
|
try:
|
||||||
|
next(gen2())
|
||||||
|
except RuntimeError:
|
||||||
|
print('RuntimeError')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user