[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] 2025-12-20 05:33:34 +00:00
parent 19609da705
commit 04bf47cb9b
2 changed files with 14 additions and 12 deletions

View file

@ -43,7 +43,7 @@ def main(argv: Sequence[str] | None = None) -> int:
for i, line in enumerate(inputfile, start=1): for i, line in enumerate(inputfile, start=1):
# Look for conflict patterns in order # Look for conflict patterns in order
if line.startswith( if line.startswith(
CONFLICT_PATTERNS[expected_conflict_pattern_index] CONFLICT_PATTERNS[expected_conflict_pattern_index],
): ):
expected_conflict_pattern_index += 1 expected_conflict_pattern_index += 1
if expected_conflict_pattern_index == N: if expected_conflict_pattern_index == N:

View file

@ -113,7 +113,8 @@ def test_merge_conflicts_git(capsys):
# Individual markers are not actually merge conflicts, need 3 markers # Individual markers are not actually merge conflicts, need 3 markers
# to mark a real conflict # to mark a real conflict
'contents, expected_retcode', 'contents, expected_retcode',
((b'<<<<<<< ', 0), (
(b'<<<<<<< ', 0),
(b'=======', 0), (b'=======', 0),
(b'>>>>>>> ', 0), (b'>>>>>>> ', 0),
# Real conflict marker # Real conflict marker
@ -121,10 +122,10 @@ def test_merge_conflicts_git(capsys):
# Allow for the possibility of an .rst file with a ======= # Allow for the possibility of an .rst file with a =======
# inside a conflict marker # inside a conflict marker
(b'<<<<<<< HEAD\n=======\n=======\n>>>>>>> branch\n', 1), (b'<<<<<<< HEAD\n=======\n=======\n>>>>>>> branch\n', 1),
) ),
) )
def test_merge_conflicts_with_rst( def test_merge_conflicts_with_rst(
contents, expected_retcode, repository_pending_merge contents, expected_retcode, repository_pending_merge,
): ):
repository_pending_merge.join('f2.rst').write_binary(contents) repository_pending_merge.join('f2.rst').write_binary(contents)
assert main(['f2.rst']) == expected_retcode assert main(['f2.rst']) == expected_retcode
@ -149,6 +150,7 @@ def test_does_not_care_when_not_in_a_merge(tmpdir):
f.write_binary(b'problem\n=======\n') f.write_binary(b'problem\n=======\n')
assert main([str(f.realpath())]) == 0 assert main([str(f.realpath())]) == 0
@pytest.mark.parametrize( @pytest.mark.parametrize(
'contents, expected_retcode', 'contents, expected_retcode',
( (
@ -156,7 +158,7 @@ def test_does_not_care_when_not_in_a_merge(tmpdir):
(b'=======', 0), (b'=======', 0),
# Complete conflict marker # Complete conflict marker
(b'<<<<<<< HEAD\nproblem\n=======\n>>>>>>> branch\n', 1), (b'<<<<<<< HEAD\nproblem\n=======\n>>>>>>> branch\n', 1),
) ),
) )
def test_care_when_assumed_merge(contents, expected_retcode, tmpdir): def test_care_when_assumed_merge(contents, expected_retcode, tmpdir):
f = tmpdir.join('README.md') f = tmpdir.join('README.md')