[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):
# Look for conflict patterns in order
if line.startswith(
CONFLICT_PATTERNS[expected_conflict_pattern_index]
CONFLICT_PATTERNS[expected_conflict_pattern_index],
):
expected_conflict_pattern_index += 1
if expected_conflict_pattern_index == N:

View file

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