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.
pull/3691/merge
Damien George 2018-04-04 01:43:16 +10:00
rodzic bc36521386
commit 430efb0444
1 zmienionych plików z 11 dodań i 0 usunięć

Wyświetl plik

@ -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))