black/tests/data/preview
Yilei "Dolee" Yang ba618a307a
Add parens around implicit string concatenations where it increases readability (#3162)
Adds parentheses around implicit string concatenations when it's inside
a list, set, or tuple. Except when it's only element and there's no trailing
comma.

Looking at the order of the transformers here, we need to "wrap in
parens" before string_split runs. So my solution is to introduce a
"collaboration" between StringSplitter and StringParenWrapper where the
splitter "skips" the split until the wrapper adds the parens (and then
the line after the paren is split by StringSplitter) in another pass.

I have also considered an alternative approach, where I tried to add a
different "string paren wrapper" class, and it runs before string_split.
Then I found out it requires a different do_transform implementation
than StringParenWrapper.do_transform, since the later assumes it runs
after the delimiter_split transform. So I stopped researching that
route.

Originally function calls were also included in this change, but given
missing commas should usually result in a runtime error and the scary
amount of changes this cause on downstream code, they were removed in
later revisions.
2022-08-30 22:52:00 -04:00
..
cantfit.py Remove hard coded test cases (#3062) 2022-05-18 12:11:37 -07:00
comments7.py Add parens around implicit string concatenations where it increases readability (#3162) 2022-08-30 22:52:00 -04:00
comments8.py Remove hard coded test cases (#3062) 2022-05-18 12:11:37 -07:00
docstring_preview.py Don't (ever) put a single-char closing docstring quote on a new line (#3166) 2022-07-13 22:26:05 -04:00
long_strings__edge_case.py Remove hard coded test cases (#3062) 2022-05-18 12:11:37 -07:00
long_strings__regression.py Add parens around implicit string concatenations where it increases readability (#3162) 2022-08-30 22:52:00 -04:00
long_strings.py Add parens around implicit string concatenations where it increases readability (#3162) 2022-08-30 22:52:00 -04:00
one_element_subscript.py Remove hard coded test cases (#3062) 2022-05-18 12:11:37 -07:00
percent_precedence.py Remove hard coded test cases (#3062) 2022-05-18 12:11:37 -07:00
remove_await_parens.py Remove hard coded test cases (#3062) 2022-05-18 12:11:37 -07:00
remove_except_parens.py Remove hard coded test cases (#3062) 2022-05-18 12:11:37 -07:00
remove_for_brackets.py Remove hard coded test cases (#3062) 2022-05-18 12:11:37 -07:00
remove_newline_after_code_block_open.py Remove newline after code block open (#3035) 2022-06-11 09:55:01 +03:00
return_annotation_brackets.py Remove hard coded test cases (#3062) 2022-05-18 12:11:37 -07:00
skip_magic_trailing_comma.py Strip trailing commas in subscripts with -C (#3209) 2022-08-13 06:41:34 -07:00