Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions tests/unit/test_patterns_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,25 @@ def test_mp2_repeated_pattern(self) -> None:
def test_mp2_separator_not_flagged(self) -> None:
assert not any(f.rule_id == "MP2" for f in mp_mod.analyze("=" * 80, "test.md", "markdown"))

@pytest.mark.parametrize(
"content",
[
pytest.param("- " * 40, id="dash_space_rule"),
pytest.param("| " * 40, id="pipe_space_columns"),
pytest.param("│ " * 30, id="box_drawing_and_padding"),
],
)
def test_mp2_layout_span_not_flagged(self, content: str) -> None:
# The single-character guard above exempts only a run of one repeated character with no
# whitespace, so alignment built from a repeated *unit* — a rule, a column, a box edge —
# falls through to _is_layout_only_span(). Each case here is reported when that helper
# is removed, which is what makes them regressions rather than restatements.
assert not any(f.rule_id == "MP2" for f in mp_mod.analyze(content, "test.md", "markdown"))

def test_mp2_layout_glyphs_beyond_the_cosmetic_span_are_still_flagged(self) -> None:
# _MAX_LAYOUT_ONLY_SPAN is the point where layout stops being a plausible explanation.
assert any(f.rule_id == "MP2" for f in mp_mod.analyze("- " * 200, "test.md", "markdown"))

@pytest.mark.parametrize(
"content",
[
Expand Down