This commit is contained in:
Yuyao Huang
2024-04-19 19:09:06 +08:00
parent 6e8c8e1998
commit 29c08c08e4
5 changed files with 31 additions and 6 deletions
+1 -5
View File
@@ -5,11 +5,7 @@ from tests.test_utils import *
])
def function():
mystring = 'hello'
print(mystring)
mystring = "hello"
print(mystring)
return 1
a, b = 3, 4
print(function())
+17
View File
@@ -11,3 +11,20 @@ def test_constant():
def target():
1
''')
def test_tuple():
@Commentor("<return>")
def target():
a, b = 1, 2
asserteq_or_print(target(), '''
def target():
a, b = 1, 2
"""
========
1 : a
2 : b
"""
''')
+1 -1
View File
@@ -1,5 +1,5 @@
from .definitions import FunctionDef, Return
from .statements import Pass, Assign
from .expressions import Expr, BinOp, Call
from .literals import Constant
from .literals import Constant, Tuple
from .variables import Name
+5
View File
@@ -1,2 +1,7 @@
def Constant(self, cmtor):
pass
def Tuple(self, cmtor):
for x in self.elts:
cmtor.process(x)
+7
View File
@@ -1,6 +1,13 @@
import ast
from ..utils import to_source
def Pass(self, cmtor):
pass
def Assign(self, cmtor):
cmtor.process(self.value)
cmtor.exec(self)
if type(self.value) not in [ast.Constant]:
cmtor.append_comment("========")
for target in self.targets:
cmtor.process(target)