Kaydet (Commit) 0d5faf3a authored tarafından Whyz Geek's avatar Whyz Geek Kaydeden (comit) Berker Peksag

added missing arguments vistor from Armin's original repo

üst 23c3432b
...@@ -8,3 +8,4 @@ And with some modifications based on Armin's code: ...@@ -8,3 +8,4 @@ And with some modifications based on Armin's code:
* Patrick Maupin <pmaupin@gmail.com> * Patrick Maupin <pmaupin@gmail.com>
* Abhishek L <abhishek.lekshmanan@gmail.com> * Abhishek L <abhishek.lekshmanan@gmail.com>
* Bob Tolbert <bob@eyesopen.com> * Bob Tolbert <bob@eyesopen.com>
* Whyzgeek <whyzgeek@gmail.com>
...@@ -8,3 +8,4 @@ ...@@ -8,3 +8,4 @@
information. information.
0.4 -- Added a visitor for NameConstant. 0.4 -- Added a visitor for NameConstant.
Added initial test suite and documentation. Added initial test suite and documentation.
0.4.1 -- Added missing SourceGenerator.visit_arguments()
...@@ -9,7 +9,7 @@ Copyright 2013 (c) Berker Peksag ...@@ -9,7 +9,7 @@ Copyright 2013 (c) Berker Peksag
""" """
__version__ = '0.4' __version__ = '0.4.1'
from .codegen import to_source # NOQA from .codegen import to_source # NOQA
from .misc import iter_node, dump, all_symbols, get_anyop # NOQA from .misc import iter_node, dump, all_symbols, get_anyop # NOQA
......
...@@ -507,3 +507,6 @@ class SourceGenerator(ExplicitNodeVisitor): ...@@ -507,3 +507,6 @@ class SourceGenerator(ExplicitNodeVisitor):
if node.ifs: if node.ifs:
for if_ in node.ifs: for if_ in node.ifs:
self.write(' if ', if_) self.write(' if ', if_)
def visit_arguments(self, node):
self.signature(node)
...@@ -47,6 +47,13 @@ class CodegenTestCase(unittest.TestCase): ...@@ -47,6 +47,13 @@ class CodegenTestCase(unittest.TestCase):
source = "del obj.x" source = "del obj.x"
self.assertAstSourceEqual(source) self.assertAstSourceEqual(source)
def test_arguments(self):
source = textwrap.dedent("""\
j = [1, 2, 3]
def test(a1, a2, b1=j, b2='123', b3={}, b4=[]):
pass""")
self.assertAstSourceEqual(source)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment