MCPcopy
hub / github.com/Textualize/textual / test_stylize

Function test_stylize

tests/test_content.py:87–101  ·  view source on GitHub ↗

Test the stylize method.

()

Source from the content-addressed store, hash-verified

85
86
87def test_stylize() -> None:
88 """Test the stylize method."""
89 foo = Content("foo bar")
90 assert foo.spans == []
91 red_foo = foo.stylize("red")
92 # stylize create a new object
93 assert foo.spans == []
94 # With no parameters, full string is stylized
95 assert red_foo.spans == [Span(0, 7, "red")]
96 red_foo = red_foo.stylize("blue", 4, 7)
97 # Another span is appended
98 assert red_foo.spans == [
99 Span(0, 7, "red"),
100 Span(4, 7, "blue"),
101 ]
102
103
104def test_stylize_before() -> None:

Callers

nothing calls this directly

Calls 3

stylizeMethod · 0.95
ContentClass · 0.90
SpanClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…