MCPcopy
hub / github.com/Textualize/rich / test_extend_style

Function test_extend_style

tests/test_text.py:1050–1063  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1048
1049
1050def test_extend_style():
1051 text = Text.from_markup("[red]foo[/red] [bold]bar")
1052 text.extend_style(0)
1053
1054 assert text.plain == "foo bar"
1055 assert text.spans == [Span(0, 3, "red"), Span(4, 7, "bold")]
1056
1057 text.extend_style(-1)
1058 assert text.plain == "foo bar"
1059 assert text.spans == [Span(0, 3, "red"), Span(4, 7, "bold")]
1060
1061 text.extend_style(2)
1062 assert text.plain == "foo bar "
1063 assert text.spans == [Span(0, 3, "red"), Span(4, 9, "bold")]
1064
1065
1066def test_append_tokens() -> None:

Callers

nothing calls this directly

Calls 3

SpanClass · 0.90
from_markupMethod · 0.80
extend_styleMethod · 0.80

Tested by

no test coverage detected