Fix whitespace issues with prefixes

This commit is contained in:
Dave Halter
2018-04-07 15:31:30 +02:00
parent f6935935c0
commit 8eda8decea
2 changed files with 32 additions and 4 deletions

View File

@@ -1,4 +1,5 @@
import pytest
from textwrap import dedent
from parso import load_grammar, ParserSyntaxError
from parso.python.tokenize import tokenize
@@ -75,5 +76,14 @@ def test_invalid(code, grammar):
)
def test_tokenize_start_pos(code, positions):
tokens = list(tokenize(code, version_info=(3, 6)))
print(tokens)
assert positions == [p.start_pos for p in tokens]
def test_roundtrip(grammar):
code = dedent("""\
f'''s{
str.uppe
'''
""")
tree = grammar.parse(code)
assert tree.get_code() == code