Skip to content

Commit

Permalink
fixup! refactor: Duplicate anchors instead of modifying them in-place
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Feb 22, 2024
1 parent 4d0e842 commit 2d4c8c6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/test_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def test_removing_duplicated_headings(ext_markdown: Markdown) -> None:
assert output.count('class="mkdocstrings') == 0


def assert_contains_in_order(items: list[str], string: str):
def _assert_contains_in_order(items: list[str], string: str) -> None:
index = 0
for item in items:
assert item in string[index:]
Expand All @@ -187,7 +187,7 @@ def test_backup_of_anchors(ext_markdown: Markdown) -> None:
output = ext_markdown.convert("::: tests.fixtures.markdown_anchors")

# Anchors with id and no href have been backed up and updated.
assert_contains_in_order(
_assert_contains_in_order(
[
'id="anchor"',
'id="tests.fixtures.markdown_anchors--anchor"',
Expand All @@ -202,15 +202,15 @@ def test_backup_of_anchors(ext_markdown: Markdown) -> None:
)

# Anchors with href and with or without id have been updated but not backed up.
assert_contains_in_order(
_assert_contains_in_order(
[
'id="tests.fixtures.markdown_anchors--with-id"',
],
output,
)
assert 'id="with-id"' not in output

assert_contains_in_order(
_assert_contains_in_order(
[
'href="#tests.fixtures.markdown_anchors--has-href1"',
'href="#tests.fixtures.markdown_anchors--has-href2"',
Expand Down

0 comments on commit 2d4c8c6

Please sign in to comment.