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

Function test_str

tests/test_style.py:8–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6
7
8def test_str():
9 assert str(Style(bold=False)) == "not bold"
10 assert str(Style(color="red", bold=False)) == "not bold red"
11 assert str(Style(color="red", bold=False, italic=True)) == "not bold italic red"
12 assert str(Style()) == "none"
13 assert str(Style(bold=True)) == "bold"
14 assert str(Style(color="red", bold=True)) == "bold red"
15 assert str(Style(color="red", bgcolor="black", bold=True)) == "bold red on black"
16 all_styles = Style(
17 color="red",
18 bgcolor="black",
19 bold=True,
20 dim=True,
21 italic=True,
22 underline=True,
23 blink=True,
24 blink2=True,
25 reverse=True,
26 conceal=True,
27 strike=True,
28 underline2=True,
29 frame=True,
30 encircle=True,
31 overline=True,
32 )
33 expected = "bold dim italic underline blink blink2 reverse conceal strike underline2 frame encircle overline red on black"
34 assert str(all_styles) == expected
35 assert str(Style(link="foo")) == "link foo"
36
37
38def test_ansi_codes():

Callers

nothing calls this directly

Calls 1

StyleClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…