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

Function test_parse

tests/test_style.py:96–115  ·  tests/test_style.py::test_parse
()

Source from the content-addressed store, hash-verified

94
95
96def test_parse():
97 assert Style.parse(class="st">"") == Style()
98 assert Style.parse(class="st">"red") == Style(color=class="st">"red")
99 assert Style.parse(class="st">"not bold") == Style(bold=False)
100 assert Style.parse(class="st">"bold red on black") == Style(
101 color=class="st">"red", bgcolor=class="st">"black", bold=True
102 )
103 assert Style.parse(class="st">"bold link https://example.org") == Style(
104 bold=True, link=class="st">"https://example.org"
105 )
106 with pytest.raises(errors.StyleSyntaxError):
107 Style.parse(class="st">"on")
108 with pytest.raises(errors.StyleSyntaxError):
109 Style.parse(class="st">"on nothing")
110 with pytest.raises(errors.StyleSyntaxError):
111 Style.parse(class="st">"rgb(999,999,999)")
112 with pytest.raises(errors.StyleSyntaxError):
113 Style.parse(class="st">"not monkey")
114 with pytest.raises(errors.StyleSyntaxError):
115 Style.parse(class="st">"link")
116
117
118def test_link_id():

Callers

nothing calls this directly

Calls 2

StyleClass · 0.90
parseMethod · 0.45

Tested by

no test coverage detected