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

Reflow hugging more aggressively

üst 36792566
...@@ -271,7 +271,7 @@ def _fix_brace(fix_data, add_comma, tokens): ...@@ -271,7 +271,7 @@ def _fix_brace(fix_data, add_comma, tokens):
# Don't unhug single element things with a multi-line component # Don't unhug single element things with a multi-line component
# inside. # inside.
not fix_data.multi_arg and 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 tokens[last_brace - 1].src in END_BRACES or
# Don't unhug when containing a single token (such as a triple # Don't unhug when containing a single token (such as a triple
# quoted string). # quoted string).
......
...@@ -594,6 +594,17 @@ def test_noop_unhugs(src): ...@@ -594,6 +594,17 @@ def test_noop_unhugs(src):
' )\n' ' )\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): 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