black/tests/data
Łukasz Langa 586d24236e Address pre-existing trailing commas when not in the rightmost bracket pair
This required some hackery.  Long story short, we need to reuse the ability to
omit rightmost bracket pairs (which glues them together and splits on something
else instead), for use with pre-existing trailing commas.

This form of user-controlled formatting is brittle so we have to be careful not
to cause a scenario where Black first formats code without trailing commas in
one way, and then looks at the same file with pre-existing trailing commas
(that it itself put on the previous run) and decides to format the code again.

One particular ugly edge case here is handling of optional parentheses.  In
particular, the long-standing `line_length=1` hack got in the way of
pre-existing trailing commas and had to be removed.  Instead, a more
intelligent but costly solution was put in place: a "second opinion" if the
formatting that omits optional parentheses ended up causing lines to be too
long.  Again, for efficiency purposes, Black reuses Leaf objects from blib2to3
and modifies them in place, which was invalid for having two separate
formattings.  Line cloning was used to mitigate this.

Fixes #1619
2020-08-25 22:10:05 +02:00
..
include_exclude_tests/b Move test data to data 2018-06-06 15:48:38 -07:00
async_as_identifier.py Add support for always tokenizing async/await as keywords 2019-05-09 17:59:29 +02:00
beginning_backslash.py Fix unstable format involving backslash + whitespace at beginning of file (#948) 2019-08-04 10:03:19 +01:00
blackd_diff.diff Fix --diff output when encountering EOF (#1328) 2020-04-04 22:02:57 -07:00
blackd_diff.py Add diff support to blackd (#969) 2019-10-28 14:25:26 +01:00
bracketmatch.py fix bracket match bug (#470) 2018-08-23 12:52:07 +01:00
cantfit.py Address pre-existing trailing commas when not in the rightmost bracket pair 2020-08-25 22:10:05 +02:00
class_blank_parentheses.py Move test data to data 2018-06-06 15:48:38 -07:00
class_methods_new_line.py Move test data to data 2018-06-06 15:48:38 -07:00
collections.py Re-implement magic trailing comma handling: 2020-08-21 16:45:30 +02:00
comment_after_escaped_newline.py Avoid unstable formatting when comment follows escaped newline. (#839). Fixes #767. 2019-05-08 09:53:20 -04:00
comments2.py Re-implement magic trailing comma handling: 2020-08-21 16:45:30 +02:00
comments3.py Fix mangling pweave and Spyder IDE special comments 2018-09-26 09:42:42 -07:00
comments4.py Improve String Handling (#1132) 2020-05-08 14:56:21 +02:00
comments5.py Move test data to data 2018-06-06 15:48:38 -07:00
comments6.py Improve String Handling (#1132) 2020-05-08 14:56:21 +02:00
comments7.py Add more trailing comma test variants 2020-08-24 18:48:11 +02:00
comments.py add bracket check in split_line (#1315) 2020-05-08 06:16:57 -07:00
composition_no_trailing_comma.py Add more trailing comma test variants 2020-08-24 18:48:11 +02:00
composition.py Improve String Handling (#1132) 2020-05-08 14:56:21 +02:00
debug_visitor.out Move INDENT value to the postponed prefix 2018-06-19 20:44:47 -07:00
debug_visitor.py Move test data to data 2018-06-06 15:48:38 -07:00
docstring.py fix some docstring crashes (#1593) 2020-08-13 16:40:45 -07:00
empty_lines.py Move test data to data 2018-06-06 15:48:38 -07:00
empty_pyproject.toml Support pyproject.toml 2018-06-06 17:02:10 -07:00
expression.diff Re-implement magic trailing comma handling: 2020-08-21 16:45:30 +02:00
expression.py Re-implement magic trailing comma handling: 2020-08-21 16:45:30 +02:00
fmtonoff2.py Move INDENT value to the postponed prefix 2018-06-19 20:44:47 -07:00
fmtonoff3.py Fix fmt on/off when multiple exist in leaf prefix (#1086) 2019-10-28 20:51:45 +01:00
fmtonoff4.py Re-implement magic trailing comma handling: 2020-08-21 16:45:30 +02:00
fmtonoff.py Fix fmt on/off when multiple exist in leaf prefix (#1086) 2019-10-28 20:51:45 +01:00
force_py36.py Move test data to data 2018-06-06 15:48:38 -07:00
force_pyi.py Move test data to data 2018-06-06 15:48:38 -07:00
fstring.py Fix string normalization sometimes producing invalid fstrings (#327) 2018-06-09 12:30:49 -07:00
function2.py Re-implement magic trailing comma handling: 2020-08-21 16:45:30 +02:00
function_trailing_comma.py Address pre-existing trailing commas when not in the rightmost bracket pair 2020-08-25 22:10:05 +02:00
function.py Re-implement magic trailing comma handling: 2020-08-21 16:45:30 +02:00
import_spacing.py Re-implement magic trailing comma handling: 2020-08-21 16:45:30 +02:00
long_strings__edge_case.py Improve String Handling (#1132) 2020-05-08 14:56:21 +02:00
long_strings__regression.py Re-implement magic trailing comma handling: 2020-08-21 16:45:30 +02:00
long_strings_flag_disabled.py Address pre-existing trailing commas when not in the rightmost bracket pair 2020-08-25 22:10:05 +02:00
long_strings.py Re-implement magic trailing comma handling: 2020-08-21 16:45:30 +02:00
numeric_literals_py2.py Uppercase digits in hex literals (#530) 2018-09-25 16:01:56 +01:00
numeric_literals_skip_underscores.py Add underscores to numeric literals with more than six digits (#529) 2018-09-26 12:32:11 +01:00
numeric_literals.py Remove numeric underscore normalization (#696) 2019-02-06 19:16:49 -08:00
pep_570.py Support PEP-570 (positional only arguments) (#946) 2019-07-28 16:17:33 +01:00
pep_572.py fix tests 2019-09-18 13:33:14 +01:00
percent_precedence.py fix unary op detection (#1600) 2020-08-14 09:17:56 -07:00
python2_print_function.py Fix print() function on Python 2 (#754) 2019-03-14 16:42:54 -07:00
python2_unicode_literals.py Improve get_future_imports implementation. 2018-07-02 17:49:47 +01:00
python2.py Move test data to data 2018-06-06 15:48:38 -07:00
python37.py Move tokenizer config onto grammar, rename flag 2019-05-09 17:59:29 +02:00
python38.py Support py38-style starred expressions in return statement (#1121) 2020-01-18 07:21:46 -08:00
remove_parens.py Back out #850 (#1079) 2019-10-20 09:02:17 -07:00
slices.py Move test data to data 2018-06-06 15:48:38 -07:00
string_prefixes.py string prefixes: don't normalise capital R-strings (#1271) 2020-03-03 14:55:14 +01:00
string_quotes.py Improve String Handling (#1132) 2020-05-08 14:56:21 +02:00
stub.pyi Add blank line after constants in stub file (#360) 2018-06-16 11:53:45 -07:00
tricky_unicode_symbols.py #455 Fix bug with tricky unicode symbols (#1047) 2019-10-13 10:21:15 -07:00
tupleassign.py Always move the prefix out when wrapping with parentheses (#1103) 2019-10-28 20:34:37 +01:00