62 lines
1.0 KiB
Python
62 lines
1.0 KiB
Python
from test_utils import *
|
|
|
|
|
|
def test_constant():
|
|
|
|
@Commentor("<return>")
|
|
def target():
|
|
x = 2
|
|
print(x == 2)
|
|
|
|
asserteq_or_print(target(), '''
|
|
def target():
|
|
x = 2
|
|
print(x == 2)
|
|
"""
|
|
True : x == 2
|
|
None : print(x == 2)
|
|
"""
|
|
''')
|
|
|
|
|
|
def test():
|
|
|
|
@Commentor("<return>")
|
|
def target():
|
|
x = 2
|
|
if x > 3:
|
|
x = 2 * x
|
|
y = 1
|
|
elif x > 2:
|
|
x = 4 * x
|
|
y = 2
|
|
elif x > 3:
|
|
x = 4 * x
|
|
y = 3
|
|
else:
|
|
x = 8 * x
|
|
y = 5
|
|
|
|
asserteq_or_print(target(), '''
|
|
def target():
|
|
x = 2
|
|
if x > 3: # False
|
|
x = 2 * x
|
|
y = 1
|
|
elif x > 2: # False
|
|
x = 4 * x
|
|
y = 2
|
|
elif x > 3: # False
|
|
x = 4 * x
|
|
y = 3
|
|
else: # True
|
|
x = 8 * x
|
|
"""
|
|
2 : x
|
|
16 : 8 * x
|
|
----------
|
|
16 : x
|
|
"""
|
|
y = 5
|
|
''')
|