black/tests
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
..
data black/parser: optimize deepcopying nodes (#2611) 2021-11-15 18:38:40 -08: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 Use optional tests for "no_python2" to simplify local testing (#2203) 2021-05-07 15:03:13 +02:00
test_black.py Allow install under pypy (#2559) 2021-11-13 19:46:15 -08:00
test_blackd.py re-implement simple CORS middleware for blackd (#2500) 2021-09-25 12:58:44 +01:00
test_format.py black/parser: support as-exprs within call args (#2608) 2021-11-14 06:04:31 -08:00
test_ipynb.py fix: allow tests to be run from (hopefully) any directory (GH-2574) 2021-10-30 11:50:45 -04:00
test_no_ipynb.py Jupyter notebook support (#2357) 2021-08-06 16:57:46 -04:00
test_primer.py Use STDIN project in test_projects to ensure it runs quickly (#2575) 2021-10-30 11:54:43 -07:00
test.toml Switch toml TOML library for tomli (#2301) 2021-07-12 16:01:38 -04:00
util.py Print out line diff on test failure (#2552) 2021-10-27 07:37:20 -07:00