Kaydet (Commit) ee808047 authored tarafından Anthony Sottile's avatar Anthony Sottile

Fix parsing of zero-length tokens

üst 3343fe9b
......@@ -325,6 +325,9 @@ def _fix_src(contents_text, py35_plus, py36_plus):
tokens = src_to_tokens(contents_text)
for i, token in _changing_list(tokens):
# DEDENT is a zero length token
if not token.src:
continue
key = Offset(token.line, token.utf8_byte_offset)
fixes = []
......
......@@ -149,9 +149,13 @@ def test_fixes_calls(src, expected):
'[1, 2, 3, 4]',
'{1, 2, 3, 4}',
'{1: 2, 3: 4}',
# Regression test for #26
'if True:\n'
' pass\n'
'[x] = {y}',
),
)
def test_noop_one_line_literals(src):
def test_noop_literals(src):
assert _fix_src(src, py35_plus=False, py36_plus=False) == src
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment