Files
python-uncompyle6/test/simple_source/bug26/03_weird26.py
rocky 278af38df6 conditional -> if_exp ...
to match Python IfExp AST
2020-02-07 16:17:47 -05:00

15 lines
452 B
Python

# From Python 2.6 test_grammar where it says:
# Grammar allows multiple adjacent 'if's in listcomps and genexps,
# even though it's silly. Make sure it works (ifelse broke this.)
[ x for x in range(10) if x % 2 if x % 3 ]
list(x for x in range(10) if x % 2 if x % 3)
# expresion which evaluates True unconditionally,
# but leave dead code or junk around that we have to match on.
# Tests "if_exp_true" rule
5 if 1 else 2
0 or max(5, 3) if 0 else 3