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
12 changes: 12 additions & 0 deletions tests/test_markup_error_message.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import pytest
from rich.text import Text
from rich.errors import MarkupError

def test_invalid_markup_message_is_actionable_mismatched_close():
bad = "[bold]hello[/italic]" # mismatched closing tag should raise
with pytest.raises(MarkupError) as exc:
Text.from_markup(bad)

msg = str(exc.value).lower()
# keep the assertions flexible so they work with current Rich messaging
assert any(word in msg for word in ("invalid", "mismatch", "closing", "end tag"))