black/tests/data
Richard Si db30456916
Don't strip parens in assert / return with assign expr (#2143)
Black would previously strip the parenthesis away from statements like this these ones:

    assert (spam := 12 + 1)
    return (cheese := 1 - 12)

Which happens to be invalid code. Now before making the parenthesis invisible, Black
checks if the assignment expression's parent is an assert stamtment, aborting if True.

Raise, yield, and await are already handled fine.

I added a bunch of test cases from the PEP defining asssignment expressions (PEP 572).
2021-04-26 08:28:42 -07: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 Remove NBSP at the beginning of comments (#2092) 2021-04-11 14:41:22 -07:00
comments_non_breaking_space.py Remove NBSP at the beginning of comments (#2092) 2021-04-11 14:41:22 -07: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
decorators.py PEP 614 support (#1717) 2020-09-19 20:33:10 +02:00
docstring_no_string_normalization.py Fix multiline docstring quote normalization 2020-08-27 01:59:41 +02:00
docstring.py Document experimental string processing and docstring indentation (#2106) 2021-04-22 10:37:27 -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_skip_magic_trailing_comma.diff Wrap arithmetic and binary arithmetic expressions in invisible parentheses (#2001) 2021-02-24 03:56:56 -08:00
expression.diff Wrap arithmetic and binary arithmetic expressions in invisible parentheses (#2001) 2021-02-24 03:56:56 -08:00
expression.py Wrap arithmetic and binary arithmetic expressions in invisible parentheses (#2001) 2021-02-24 03:56:56 -08: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
fmtskip2.py Add "# fmt: skip" directive to black (#1800) 2021-02-15 08:02:48 -08:00
fmtskip3.py Add "# fmt: skip" directive to black (#1800) 2021-02-15 08:02:48 -08:00
fmtskip4.py Add "# fmt: skip" directive to black (#1800) 2021-02-15 08:02:48 -08:00
fmtskip5.py Add "# fmt: skip" directive to black (#1800) 2021-02-15 08:02:48 -08:00
fmtskip.py Add "# fmt: skip" directive to black (#1800) 2021-02-15 08:02:48 -08:00
force_py36.py Move test data to data 2018-06-06 15:48:38 -07:00
force_pyi.py Fix empty line handling when formatting typing stubs (#1646) 2020-09-10 13:21:37 -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 Fix INTERNAL ERROR caused by removing parens from pointless string (#1888) 2020-12-28 12:30:23 -08: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 Fix unstable formatting on string split + % formatting (#1680) 2020-09-05 17:24:00 -07:00
missing_final_newline.diff Indicate that a final newline was added in --diff (#1897) (#1897) 2021-02-21 22:43:23 -08:00
missing_final_newline.py Indicate that a final newline was added in --diff (#1897) (#1897) 2021-02-21 22:43:23 -08:00
numeric_literals_py2.py Revert "Use lowercase hex numbers fixes #1692 (#1775)" 2021-04-25 19:13:23 +02:00
numeric_literals_skip_underscores.py Revert "Use lowercase hex numbers fixes #1692 (#1775)" 2021-04-25 19:13:23 +02:00
numeric_literals.py Revert "Use lowercase hex numbers fixes #1692 (#1775)" 2021-04-25 19:13:23 +02:00
pep_570.py Support PEP-570 (positional only arguments) (#946) 2019-07-28 16:17:33 +01:00
pep_572_remove_parens.py Don't strip parens in assert / return with assign expr (#2143) 2021-04-26 08:28:42 -07:00
pep_572.py Strip redundant parentheses from assignment exprs (#1906) 2021-02-27 17:20:23 -08: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 Allow same RHS expressions in annotated assignments as in regular assignments (#1835) 2020-11-24 09:39:25 +00:00
python39.py PEP 614 support (#1717) 2020-09-19 20:33:10 +02:00
remove_parens.py Strip redundant parentheses from assignment exprs (#1906) 2021-02-27 17:20:23 -08: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
trailing_comma_optional_parens1.py Add expected failure tests with the unstable formattings 2020-08-26 16:55:05 +02:00
trailing_comma_optional_parens2.py Add expected failure tests with the unstable formattings 2020-08-26 16:55:05 +02:00
trailing_comma_optional_parens3.py Add expected failure tests with the unstable formattings 2020-08-26 16:55:05 +02: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