Actually get the first few written tests passing.

This commit is contained in:
Dave Halter
2014-10-09 13:21:30 +02:00
parent 68d23840bb
commit 92ee2a912e
2 changed files with 2 additions and 12 deletions

View File

@@ -127,7 +127,7 @@ class Node(Base):
__str__ = __unicode__ __str__ = __unicode__
def get_code(self): def get_code(self):
return str(self) return "".join(c.get_code() for c in self.children)
@property @property
def prefix(self): def prefix(self):

View File

@@ -4,7 +4,7 @@ from jedi.parser import pytree
from jedi.parser.pgen2 import Driver from jedi.parser.pgen2 import Driver
def test_basic(): def test_basic_parsing():
def compare(string): def compare(string):
"""Generates the AST object and then regenerates the code.""" """Generates the AST object and then regenerates the code."""
assert d.parse_string(string).get_code() == string assert d.parse_string(string).get_code() == string
@@ -22,14 +22,4 @@ def test_basic():
compare('wblabla* 1\t\n') compare('wblabla* 1\t\n')
compare('def x(a, b:3): pass\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 assert False