Compare()
This commit is contained in:
parent
29c08c08e4
commit
245a927382
@ -5,7 +5,8 @@ from tests.test_utils import *
|
||||
|
||||
])
|
||||
def function():
|
||||
a, b = 3, 4
|
||||
x = 2
|
||||
print(x == 2)
|
||||
|
||||
|
||||
print(function())
|
||||
|
||||
19
tests/test_conditions.py
Normal file
19
tests/test_conditions.py
Normal file
@ -0,0 +1,19 @@
|
||||
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)
|
||||
"""
|
||||
''')
|
||||
@ -1,5 +1,5 @@
|
||||
from .definitions import FunctionDef, Return
|
||||
from .statements import Pass, Assign
|
||||
from .expressions import Expr, BinOp, Call
|
||||
from .expressions import Expr, BinOp, Call, Compare
|
||||
from .literals import Constant, Tuple
|
||||
from .variables import Name
|
||||
|
||||
@ -6,6 +6,11 @@ def BinOp(self, cmtor):
|
||||
cmtor.process(self.right)
|
||||
cmtor.append_comment(cmtor.eval(self))
|
||||
|
||||
def Compare(self, cmtor):
|
||||
for cmp in self.comparators:
|
||||
cmtor.process(cmp)
|
||||
cmtor.append_comment(cmtor.eval(self))
|
||||
|
||||
def Call(self, cmtor):
|
||||
for arg in self.args:
|
||||
cmtor.process(arg)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user