Skip to content

Commit 8c204a0

Browse files
committed
Fix test_from_rich_text in test_content.py.
Fix bug where `content.spans` was not being tested. Autoformatting included: `uvx black tests/test_content.py`
1 parent 3427dba commit 8c204a0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/test_content.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ def test_from_rich_text():
5252
content = Content.from_rich_text(text)
5353
assert len(content) == 11
5454
assert content.plain == "Hello World"
55-
assert [Span(start=0, end=5, style="red"), Span(start=6, end=11, style="blue")]
55+
assert content.spans == [
56+
Span(start=0, end=5, style="red"),
57+
Span(start=6, end=11, style="blue"),
58+
]
5659

5760

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

142+
139143
def test_radd() -> None:
140144
"""Test reverse addition."""
141145
assert "foo" + Content("bar") == Content("foobar")
@@ -145,6 +149,7 @@ def test_radd() -> None:
145149
assert str(content) == "foo bar"
146150
assert content.spans == [Span(4, 7, "blue")]
147151

152+
148153
def test_from_markup():
149154
"""Test simple parsing of content markup."""
150155
content = Content.from_markup("[red]Hello[/red] [blue]World[/blue]")

0 commit comments

Comments
 (0)