black/tests/data
Antonio Ossa-Guerra d97b7898b3
Remove whitespaces of whitespace-only files (#3348)
Currently, empty and whitespace-only (with or without newlines) are
not modified. In some discussions (issues and pull requests) consensus
was to reformat whitespace-only files to empty or single-character
files, preserving line endings when possible. With that said, this
commit introduces the following behaviors:

* Empty files are left as is
* Whitespace-only files (no newline) reformat into empty files
* Whitespace-only files (1 or more newlines) reformat into a single
newline character

To implement these changes, we moved the initial check at
`format_file_contents` that raises `NothingChanged` if the source
(with no whitespaces) is an empty string. In the case of *.ipynb
files, `format_ipynb_string` checks a similar condition and removed
whitespaces. In the case of Python files, `format_str_once` includes a
check on the output that returns the correct newline character if
possible or an empty string otherwise.

Signed-off-by: Antonio Ossa Guerra <aaossa@uc.cl>
2022-11-11 20:05:36 -05:00
..
fast Remove hard coded test cases (#3062) 2022-05-18 12:11:37 -07:00
gitignore_used_on_multiple_sources Apply .gitignore correctly in every source entry (#3336) 2022-11-04 22:09:59 -07:00
ignore_subfolders_gitignore_tests Compare each .gitignore found with an appropiate relative path (#3338) 2022-11-08 07:50:04 -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
jupyter Remove hard coded test cases (#3062) 2022-05-18 12:11:37 -07:00
miscellaneous Add option to skip the first line of source code (#3299) 2022-10-06 15:17:32 -07:00
nested_gitignore_tests Fix: black only respects the root gitignore. (#2225) 2021-05-16 13:51:27 -04:00
preview Remove whitespaces of whitespace-only files (#3348) 2022-11-11 20:05:36 -05:00
preview_39 Remove hard coded test cases (#3062) 2022-05-18 12:11:37 -07:00
preview_310 Use underscores instead of a space in a test file's name (#3180) 2022-07-19 21:33:00 -04:00
py_36 Remove hard coded test cases (#3062) 2022-05-18 12:11:37 -07:00
py_37 Remove hard coded test cases (#3062) 2022-05-18 12:11:37 -07:00
py_38 Remove hard coded test cases (#3062) 2022-05-18 12:11:37 -07:00
py_39 Remove hard coded test cases (#3062) 2022-05-18 12:11:37 -07:00
py_310 Add support for named exprs inside function calls as gen-exps (#3327) 2022-10-11 10:54:09 +11:00
py_311 Implement support for PEP 646 (#3071) 2022-05-26 09:45:22 -07:00
simple_cases Correctly handle trailing commas that are inside a line's leading non-nested parens (#3370) 2022-11-09 15:08:51 -08:00
empty_pyproject.toml Support pyproject.toml 2018-06-06 17:02:10 -07:00