Unverified Kaydet (Commit) 074047d5 authored tarafından Anthony Sottile's avatar Anthony Sottile Kaydeden (comit) GitHub

Merge pull request #71 from asottile/reflow_more_hugging

Reflow hugging more aggressively
......@@ -271,7 +271,7 @@ def _fix_brace(fix_data, add_comma, tokens):
# Don't unhug single element things with a multi-line component
# inside.
not fix_data.multi_arg and
hug_open and
tokens[first_brace + 1].src in START_BRACES and
tokens[last_brace - 1].src in END_BRACES or
# Don't unhug when containing a single token (such as a triple
# quoted string).
......
......@@ -594,6 +594,17 @@ def test_noop_unhugs(src):
' )\n'
']',
),
pytest.param(
'x = [x\n'
' for x in y()]\n',
'x = [\n'
' x\n'
' for x in y()\n'
']\n',
id='#42: listcomp unhug ends in brace',
),
),
)
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