black/tests
Yilei "Dolee" Yang 55db05519e
Fix a crash when # fmt: on is used on a different block level than # fmt: off (#3281)
Previously _Black_ produces invalid code because the `# fmt: on` is used on a different block level.

While _Black_ requires `# fmt: off` and `# fmt: on` to be used at the same block level, incorrect usage shouldn't cause crashes.

The formatting behavior this PR introduces is, the code below the initial `# fmt: off` block level will be turned off for formatting, when `# fmt: on` is used on a different level or there is no `# fmt: on`. This also matches the current behavior when `# fmt: off` is used at the top-level without a matching `# fmt: on`, it turns off formatting for everything below `# fmt: off`.

- Fixes #2567
- Fixes #3184
- Fixes #2985
- Fixes #2882
- Fixes #2232
- Fixes #2140
- Fixes #1817
- Fixes #569
2022-09-23 20:37:22 -07:00
..
data Fix a crash when # fmt: on is used on a different block level than # fmt: off (#3281) 2022-09-23 20:37:22 -07: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 strict mypy checking (#3222) 2022-08-30 20:46:46 -07:00
test_black.py Use .gitignore files in the initial source directories (#3237) 2022-08-31 15:47:42 -04:00
test_blackd.py Move 3.11 tests to install aiohttp without C extensions (#3258) 2022-09-06 08:27:39 +10: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