black/tests
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
..
data Add parens around implicit string concatenations where it increases readability (#3162) 2022-08-30 22:52:00 -04:00
__init__.py Remove deprecated use of 'setup.py test' (#1275) 2020-05-08 06:23:50 -07:00
conftest.py Use optional tests for "no_python2" to simplify local testing (#2203) 2021-05-07 15:03:13 +02:00
empty.toml Add --target-version option to allow users to choose targeted Python versions (#618) 2019-02-06 18:43:50 -08:00
optional.py Reformat codebase with isort 2022-07-27 17:19:28 -04:00
test_black.py Add parens around implicit string concatenations where it increases readability (#3162) 2022-08-30 22:52:00 -04:00
test_blackd.py Add passing 3.11 CI by exempting blackd tests (#3234) 2022-08-22 20:39:48 -07:00
test_format.py Strip trailing commas in subscripts with -C (#3209) 2022-08-13 06:41:34 -07:00
test_ipynb.py Reformat codebase with isort 2022-07-27 17:19:28 -04:00
test_no_ipynb.py Reformat codebase with isort 2022-07-27 17:19:28 -04:00
test_trans.py Reformat codebase with isort 2022-07-27 17:19:28 -04:00
test.toml Add support for custom python cell magics (#2744) 2022-01-20 16:45:28 -08:00
util.py Remove hard coded test cases (#3062) 2022-05-18 12:11:37 -07:00