tests/basics: Add test for use of return within try-except.

The case of a return statement in the try suite of a try-except statement
was previously only tested by builtin_compile.py, and only then in the part
of this test which checked for the existence of the compile builtin.  So
this patch adds an explicit unit test for this case.
This commit is contained in:
Damien George 2018-04-04 01:43:16 +10:00
parent bc36521386
commit 430efb0444

View File

@ -0,0 +1,11 @@
# test use of return with try-except
def f(l, i):
try:
return l[i]
except IndexError:
print('IndexError')
return -1
print(f([1], 0))
print(f([], 0))