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
7 changes: 6 additions & 1 deletion tests/test_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ def test_from_rich_text():
content = Content.from_rich_text(text)
assert len(content) == 11
assert content.plain == "Hello World"
assert [Span(start=0, end=5, style="red"), Span(start=6, end=11, style="blue")]
assert content.spans == [
Span(start=0, end=5, style="red"),
Span(start=6, end=11, style="blue"),
]


def test_styled():
Expand Down Expand Up @@ -136,6 +139,7 @@ def test_add() -> None:
assert content.spans == [Span(0, 3, "red"), Span(4, 7, "blue")]
assert content.cell_length == 7


def test_radd() -> None:
"""Test reverse addition."""
assert "foo" + Content("bar") == Content("foobar")
Expand All @@ -145,6 +149,7 @@ def test_radd() -> None:
assert str(content) == "foo bar"
assert content.spans == [Span(4, 7, "blue")]


def test_from_markup():
"""Test simple parsing of content markup."""
content = Content.from_markup("[red]Hello[/red] [blue]World[/blue]")
Expand Down