Files
python-uncompyle6/test/simple_source/bug37/03_ifelse_chained_for.py
rocky c6ddefcef5 Merging in recent 3.7 and 3.8 improvements from decompyle6
This rebases 3.7, 3.8 ...decompilation off of 3.7ish rather than a 3.4
base.

Add more 3.7 and 3.8 tests
2019-12-08 17:54:59 -05:00

25 lines
630 B
Python

# From decompyle3/semantics/customize3.py
# The bug is handling "for" loop inside the
# chained compare ifelse
def n_classdef3(a, b, c, l):
r = 1
if 3.0 <= a <= 3.2:
for n in l:
if b:
break
elif c:
r = 2
pass
pass
else:
r = 3
pass
return r
assert n_classdef3(10, True, True, []) == 3
assert n_classdef3(0, False, True, []) == 3
assert n_classdef3(3.1, True, True, []) == 1
assert n_classdef3(3.1, True, False, [1]) == 1
assert n_classdef3(3.1, True, True, [2]) == 1
assert n_classdef3(3.1, False, True, [3]) == 2