You've already forked Core2forAWS-MicroPython
mirror of
https://github.com/m5stack/Core2forAWS-MicroPython.git
synced 2026-05-20 10:30:31 -07:00
tests/basics: Add test for logical constant folding.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
# tests logical constant folding in parser
|
||||
|
||||
def f_true():
|
||||
print('f_true')
|
||||
return True
|
||||
|
||||
def f_false():
|
||||
print('f_false')
|
||||
return False
|
||||
|
||||
print(0 or False)
|
||||
print(1 or foo)
|
||||
print(f_false() or 1 or foo)
|
||||
print(f_false() or 1 or f_true())
|
||||
|
||||
print(0 and foo)
|
||||
print(1 and True)
|
||||
print(f_true() and 0 and foo)
|
||||
print(f_true() and 1 and f_false())
|
||||
|
||||
print(not 0)
|
||||
print(not False)
|
||||
print(not 1)
|
||||
print(not True)
|
||||
print(not not 0)
|
||||
print(not not 1)
|
||||
Reference in New Issue
Block a user