mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
This also includes a rework for error recovery in the parser. This is now just possible for file_input parsing, which means for full files. Includes also a refactoring of the tokenizer. No more do we have to add an additional newline, because it now works correctly (removes certain confusion.
14 lines
435 B
Python
14 lines
435 B
Python
from jedi._compatibility import u
|
|
from jedi.parser import ParserWithRecovery, load_grammar
|
|
|
|
|
|
def test_basic_parsing():
|
|
def compare(string):
|
|
"""Generates the AST object and then regenerates the code."""
|
|
assert ParserWithRecovery(load_grammar(), string).module.get_code() == string
|
|
|
|
compare(u('\na #pass\n'))
|
|
compare(u('wblabla* 1\t\n'))
|
|
compare(u('def x(a, b:3): pass\n'))
|
|
compare(u('assert foo\n'))
|