Files
python-uncompyle6/test/simple_source/bug26/01_ifelse_listcomp.py
2019-05-08 16:27:41 -04:00

12 lines
441 B
Python

# Bug from issue #171: parsing "if x if a else y" inside a list comprehension on 2.7
# This is RUNNABLE!
assert [False, True, True, True, True] == [False if not a else True for a in range(5)]
assert [True, False, False, False, False] == [False if a else True for a in range(5)]
# From bug #225
m = ['hi', 'he', 'ih', 'who', 'ho']
ms = {}
for f in (f for f in m if f.startswith('h')):
ms[f] = 5
assert ms == {'hi': 5, 'he': 5, 'ho': 5}