Tuple
This commit is contained in:
parent
6e8c8e1998
commit
29c08c08e4
@ -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())
|
||||
|
||||
@ -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,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
|
||||
|
||||
@ -1,2 +1,7 @@
|
||||
def Constant(self, cmtor):
|
||||
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):
|
||||
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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user