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

Don't introduce trailing whitespace on blank lines when unhugging

üst f1666043
......@@ -271,7 +271,7 @@ def _fix_brace(fix_data, add_comma, tokens):
indents = []
insert_indents = []
for i in range(first_brace + 3, last_brace):
if tokens[i - 1].name == 'NL':
if tokens[i - 1].name == 'NL' and tokens[i].name != 'NL':
if tokens[i].name != UNIMPORTANT_WS:
min_indent = 0
insert_indents.append(i)
......
......@@ -473,6 +473,22 @@ def test_noop_unhugs(src):
' "bar"\n'
')',
),
# Regression test for #17
(
'x("foo", (\n'
' "bar",\n'
'\n'
' "baz",\n'
'))',
'x(\n'
' "foo", (\n'
' "bar",\n'
'\n'
' "baz",\n'
' ),\n'
')',
),
),
)
def test_fix_unhugs(src, expected):
......
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