File: test_new_parser.py

package info (click to toggle)
python-jedi 0.10.0~git1%2Bf05c071-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,064 kB
  • ctags: 3,014
  • sloc: python: 16,997; makefile: 149; ansic: 13
file content (13 lines) | stat: -rw-r--r-- 435 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
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'))