[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2026-04-03 08:47:37 +00:00
parent 4842364696
commit a455566742
3 changed files with 12 additions and 11 deletions

View file

@ -44,7 +44,7 @@ def test_fix_file(input_s, expected_retval, output, options):
options = [options]
file_obj = io.BytesIO(input_s)
ret = fix_file(file_obj, "--check" in [*options])
ret = fix_file(file_obj, '--check' in [*options])
assert file_obj.getvalue() == output
assert ret == expected_retval

View file

@ -18,21 +18,22 @@ def test_fixes_trailing_whitespace(input_s, expected, tmpdir):
assert main((str(path),)) == 1
assert path.read() == expected
@pytest.mark.parametrize(
('input_s', 'exit_code', "lines"),
('input_s', 'exit_code', 'lines'),
(
('foo \nbar \n', 1, [1,2]),
('bar\t\nbaz\t\n', 1, [1,2]),
('bar\nbaz\t\n', 1, [2]),
('foo \nbar \n', 1, [1, 2]),
('bar\t\nbaz\t\n', 1, [1, 2]),
('bar\nbaz\t\n', 1, [2]),
),
)
def test_fixes_trailing_whitespace_check_only(capsys, input_s, exit_code, lines, tmpdir):
path = tmpdir.join('file.md')
path.write(input_s)
assert main(('--check', str(path),)) == exit_code
assert main(('--check', str(path))) == exit_code
assert path.read() == input_s
captured = capsys.readouterr()
location = "@ " + ','.join(map(str, lines))
location = '@ ' + ','.join(map(str, lines))
assert location in captured.out