mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-11 00:01:54 +08:00
Refactored the parser calls. Now it's possible to use jedi.parser.python.parse to quickly parse something.
This commit is contained in:
@@ -8,9 +8,9 @@ test_grammar.py files from both Python 2 and Python 3.
|
||||
|
||||
from textwrap import dedent
|
||||
|
||||
|
||||
from jedi._compatibility import unicode, is_py3
|
||||
from jedi.parser import Parser, load_grammar, ParseError
|
||||
from jedi._compatibility import is_py3
|
||||
from jedi.parser.python import parse as _parse, load_grammar
|
||||
from jedi.parser import ParseError
|
||||
import pytest
|
||||
|
||||
from test.helpers import TestCase
|
||||
@@ -19,7 +19,7 @@ from test.helpers import TestCase
|
||||
def parse(code, version='3.4'):
|
||||
code = dedent(code) + "\n\n"
|
||||
grammar = load_grammar(version=version)
|
||||
return Parser(grammar, unicode(code), 'file_input').get_parsed_node()
|
||||
return _parse(code, grammar, error_recovery=False)
|
||||
|
||||
|
||||
class TestDriver(TestCase):
|
||||
|
||||
Reference in New Issue
Block a user