Fix the token types.

This commit is contained in:
Dave Halter
2017-05-30 02:05:45 +02:00
parent 6640308d15
commit 3e4b2f41cd
2 changed files with 19 additions and 4 deletions

View File

@@ -22,3 +22,17 @@ def test_simple_prefix_splitting(string, tokens):
assert leaf.type == 'endmarker'
parsed_tokens = list(leaf._split_prefix())
assert [t.value for t in parsed_tokens] == tokens
@pytest.mark.parametrize(('string', 'types'), [
('# ', ['comment']),
('\r\n', ['newline']),
('\f', ['formfeed']),
('\\\n', ['backslash']),
])
def test_prefix_splitting_types(string, types):
tree = parso.parse(string)
leaf = tree.children[0]
assert leaf.type == 'endmarker'
parsed_tokens = list(leaf._split_prefix())
assert [t.type for t in parsed_tokens] == types