mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-16 01:17:13 +08:00
Fix the token types.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user