tests/basics: Add test for throw into yield-from with normal return.
This test was found by missing coverage of a branch in py/nativeglue.c.
This commit is contained in:
parent
809d89c794
commit
27fe84e661
@ -34,3 +34,17 @@ try:
|
|||||||
print(next(g))
|
print(next(g))
|
||||||
except TypeError:
|
except TypeError:
|
||||||
print("got TypeError from downstream!")
|
print("got TypeError from downstream!")
|
||||||
|
|
||||||
|
# thrown value is caught and then generator returns normally
|
||||||
|
def gen():
|
||||||
|
try:
|
||||||
|
yield 123
|
||||||
|
except ValueError:
|
||||||
|
print('ValueError')
|
||||||
|
# return normally after catching thrown exception
|
||||||
|
def gen2():
|
||||||
|
yield from gen()
|
||||||
|
yield 789
|
||||||
|
g = gen2()
|
||||||
|
print(next(g))
|
||||||
|
print(g.throw(ValueError))
|
||||||
|
Loading…
Reference in New Issue
Block a user