black/tests/data
Batuhan Taskaya d7b091e762
black/parser: optimize deepcopying nodes (#2611)
The implementation of the new backtracking logic depends heavily on deepcopying the current state of the parser before seeing one of the new keywords, which by default is an very expensive operations. On my system, formatting these 3 files takes 1.3 seconds.

```
 $ touch tests/data/pattern_matching_*; time python -m black -tpy310 tests/data/pattern_matching_*             19ms
All done!  🍰 
3 files left unchanged.
python -m black -tpy310 tests/data/pattern_matching_*  2,09s user 0,04s system 157% cpu 1,357 total
```

which can be optimized 3X if we integrate the existing copying logic (`clone`) to the deepcopy system;
```
 $ touch tests/data/pattern_matching_*; time python -m black -tpy310 tests/data/pattern_matching_*              1ms
All done!  🍰 
3 files left unchanged.
python -m black -tpy310 tests/data/pattern_matching_*  0,66s user 0,02s system 147% cpu 0,464 total
```

This still might have some potential, but that would be way trickier than this initial patch.
2021-11-15 18:38:40 -08:00
..
include_exclude_tests Do not use gitignore if explicitly passing excludes (#2170) 2021-05-07 14:54:21 +02:00
invalid_gitignore_tests Present a more user-friendly error if .gitignore is invalid (#2414) 2021-08-20 19:54:53 -04:00
invalid_nested_gitignore_tests Present a more user-friendly error if .gitignore is invalid (#2414) 2021-08-20 19:54:53 -04:00
nested_gitignore_tests Fix: black only respects the root gitignore. (#2225) 2021-05-16 13:51:27 -04: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 Mention comment non-processing in documentation (#2306) 2021-06-08 17:57:23 -04: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 Detect '@' dotted_name '(' ')' NEWLINE as a simple decorator (#2182) 2021-05-04 10:46:46 +02:00
docstring_no_string_normalization.py Add more tests for fancy whitespace (#2147) 2021-04-26 20:24:06 +02:00
docstring.py Removed adding a space into empty docstrings. (#2249) 2021-05-25 15:43:28 -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
fmtskip6.py Possible fix for issue with indentation and fmt: skip (#2281) 2021-06-08 14:37:34 -07: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 Stop changing return type annotations to tuples (#2384) 2021-08-25 18:32:27 -07: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 Account for += assignment when deciding whether to split string (#2312) 2021-06-07 07:01:57 -07:00
long_strings__regression.py Fix internal error when FORCE_OPTIONAL_PARENTHESES feature is enabled (#2332) 2021-06-13 10:20:50 -07: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 Support named escapes (\N{...}) in string processing (#2319) 2021-06-09 12:29:32 -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
non_python_notebook.ipynb Jupyter notebook support (#2357) 2021-08-06 16:57:46 -04:00
notebook_empty_metadata.ipynb Jupyter notebook support (#2357) 2021-08-06 16:57:46 -04:00
notebook_no_trailing_newline.ipynb Jupyter notebook support (#2357) 2021-08-06 16:57:46 -04:00
notebook_trailing_newline.ipynb Jupyter notebook support (#2357) 2021-08-06 16:57:46 -04:00
notebook_which_cant_be_parsed.ipynb Jupyter notebook support (#2357) 2021-08-06 16:57:46 -04:00
notebook_without_changes.ipynb Jupyter notebook support (#2357) 2021-08-06 16:57:46 -04: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
parenthesized_context_managers.py black/parser: partial support for pattern matching (#2586) 2021-11-13 19:15:31 -08:00
pattern_matching_complex.py black/parser: partial support for pattern matching (#2586) 2021-11-13 19:15:31 -08:00
pattern_matching_extras.py black/parser: optimize deepcopying nodes (#2611) 2021-11-15 18:38:40 -08:00
pattern_matching_simple.py black/parser: partial support for pattern matching (#2586) 2021-11-13 19:15:31 -08:00
pep_570.py Support PEP-570 (positional only arguments) (#946) 2019-07-28 16:17:33 +01:00
pep_572_do_not_remove_parens.py Stop stripping parens in even more illegal spots (#2148) 2021-04-26 22:26:43 +02:00
pep_572_py39.py blib2to3: support unparenthesized wulruses in more places (#2447) 2021-08-26 13:59:01 -07:00
pep_572_py310.py blib2to3: support unparenthesized wulruses in more places (#2447) 2021-08-26 13:59:01 -07:00
pep_572_remove_parens.py Stop stripping parens in even more illegal spots (#2148) 2021-04-26 22:26:43 +02: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_detection.py Improve Python 2 only syntax detection (GH-2592) 2021-11-11 20:28:48 -05: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 Regression fix: leave R prefixes capitalization alone (#2285) 2021-06-08 17:46:09 -07:00
string_quotes.py Improve f-string expression detection regex so ... (#2437) 2021-08-22 19:52:19 -07: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