dot_files/bundle/jedi-vim/jedi/test/test_new_parser.py

14 lines
435 B
Python
Raw Normal View History

2017-07-09 00:19:01 +03:00
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'))