Start actual testing of the new parser.

This commit is contained in:
Dave Halter
2014-10-09 13:16:28 +02:00
parent daee273a08
commit 68d23840bb
3 changed files with 14 additions and 4 deletions

View File

@@ -7,7 +7,7 @@ from jedi.parser.pgen2 import Driver
def test_basic():
def compare(string):
"""Generates the AST object and then regenerates the code."""
return d.parse_string(string).get_code() == string
assert d.parse_string(string).get_code() == string
#if self.options["print_function"]:
# python_grammar = pygram.python_grammar_no_print_statement
@@ -18,6 +18,10 @@ def test_basic():
logger = logging.getLogger("RefactoringTool")
d = Driver(pytree.python_grammar, convert=pytree.convert, logger=logger)
compare('\na #pass\n')
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))