You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 08:49:51 +08:00
@@ -2,7 +2,8 @@
|
||||
# lambda's have to be more or less on a line
|
||||
|
||||
f = lambda x: 1 if x<2 else 3
|
||||
f(5)
|
||||
assert f(3) == 3
|
||||
assert f(1) == 1
|
||||
|
||||
# If that wasn't enough ...
|
||||
# Python will create dead code
|
||||
@@ -10,10 +11,18 @@ f(5)
|
||||
# not to include the else expression
|
||||
|
||||
g = lambda: 1 if True else 3
|
||||
g()
|
||||
assert g() == 1
|
||||
|
||||
h = lambda: 1 if False else 3
|
||||
h()
|
||||
assert h() == 3
|
||||
|
||||
# From 2.7 test_builtin
|
||||
lambda c: 'a' <= c <= 'z', 'Hello World'
|
||||
i = lambda c: 'a' <= c <= 'z', 'Hello World'
|
||||
assert i[0]('a') == True
|
||||
assert i[0]('A') == False
|
||||
|
||||
# Issue #170. Bug is needing an "conditional_not_lambda" grammar rule
|
||||
# in addition the the "conditional_lambda" rule
|
||||
j = lambda a: False if not a else True
|
||||
assert j(True) == True
|
||||
assert j(False) == False
|
||||
|
Reference in New Issue
Block a user