mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +08:00
Add a new parser, check it pgen2 would work. (already modified outside this repository)
This commit is contained in:
27
test/test_new_parser.py
Normal file
27
test/test_new_parser.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import logging
|
||||
|
||||
from jedi.parser import pytree
|
||||
from jedi.parser.pgen2 import Driver
|
||||
|
||||
|
||||
def test_basic():
|
||||
#if self.options["print_function"]:
|
||||
# python_grammar = pygram.python_grammar_no_print_statement
|
||||
#else:
|
||||
# When this is True, the refactor*() methods will call write_file() for
|
||||
# files processed even if they were not changed during refactoring. If
|
||||
# and only if the refactor method's write parameter was True.
|
||||
logger = logging.getLogger("RefactoringTool")
|
||||
d = Driver(pytree.python_grammar, convert=pytree.convert, logger=logger)
|
||||
|
||||
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(): pass\n')))
|
||||
print()
|
||||
x = d.parse_string('\na #pass\n')
|
||||
print(repr(x))
|
||||
print(x)
|
||||
assert False
|
||||
Reference in New Issue
Block a user