From 92ee2a912e17fffa14e9cec0a6eaba260f51be8d Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Thu, 9 Oct 2014 13:21:30 +0200 Subject: [PATCH] Actually get the first few written tests passing. --- jedi/parser/pytree.py | 2 +- test/test_new_parser.py | 12 +----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/jedi/parser/pytree.py b/jedi/parser/pytree.py index f336b898..66fe780d 100644 --- a/jedi/parser/pytree.py +++ b/jedi/parser/pytree.py @@ -127,7 +127,7 @@ class Node(Base): __str__ = __unicode__ def get_code(self): - return str(self) + return "".join(c.get_code() for c in self.children) @property def prefix(self): diff --git a/test/test_new_parser.py b/test/test_new_parser.py index 88620729..d361ea5c 100644 --- a/test/test_new_parser.py +++ b/test/test_new_parser.py @@ -4,7 +4,7 @@ from jedi.parser import pytree from jedi.parser.pgen2 import Driver -def test_basic(): +def test_basic_parsing(): def compare(string): """Generates the AST object and then regenerates the code.""" assert d.parse_string(string).get_code() == string @@ -22,14 +22,4 @@ def test_basic(): compare('wblabla* 1\t\n') compare('def x(a, b:3): pass\n') - print(d) - tree = d.parse_string('wblabla* 1\t\n') - print(repr(tree)) - print(tree) - #import pdb; pdb.set_trace() - print(repr(d.parse_string('def x(a, b:3): pass\n'))) - print() - x = d.parse_string('\na #pass\n') - print(repr(x)) - print(x.get_code()) assert False