Tuple
This commit is contained in:
parent
6e8c8e1998
commit
29c08c08e4
@ -5,11 +5,7 @@ from tests.test_utils import *
|
|||||||
|
|
||||||
])
|
])
|
||||||
def function():
|
def function():
|
||||||
mystring = 'hello'
|
a, b = 3, 4
|
||||||
print(mystring)
|
|
||||||
mystring = "hello"
|
|
||||||
print(mystring)
|
|
||||||
return 1
|
|
||||||
|
|
||||||
|
|
||||||
print(function())
|
print(function())
|
||||||
|
|||||||
@ -11,3 +11,20 @@ def test_constant():
|
|||||||
def target():
|
def target():
|
||||||
1
|
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,5 +1,5 @@
|
|||||||
from .definitions import FunctionDef, Return
|
from .definitions import FunctionDef, Return
|
||||||
from .statements import Pass, Assign
|
from .statements import Pass, Assign
|
||||||
from .expressions import Expr, BinOp, Call
|
from .expressions import Expr, BinOp, Call
|
||||||
from .literals import Constant
|
from .literals import Constant, Tuple
|
||||||
from .variables import Name
|
from .variables import Name
|
||||||
|
|||||||
@ -1,2 +1,7 @@
|
|||||||
def Constant(self, cmtor):
|
def Constant(self, cmtor):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def Tuple(self, cmtor):
|
||||||
|
for x in self.elts:
|
||||||
|
cmtor.process(x)
|
||||||
|
|||||||
@ -1,6 +1,13 @@
|
|||||||
|
import ast
|
||||||
|
from ..utils import to_source
|
||||||
|
|
||||||
def Pass(self, cmtor):
|
def Pass(self, cmtor):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def Assign(self, cmtor):
|
def Assign(self, cmtor):
|
||||||
cmtor.process(self.value)
|
cmtor.process(self.value)
|
||||||
cmtor.exec(self)
|
cmtor.exec(self)
|
||||||
|
if type(self.value) not in [ast.Constant]:
|
||||||
|
cmtor.append_comment("========")
|
||||||
|
for target in self.targets:
|
||||||
|
cmtor.process(target)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user