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

Function test_theme_stack

tests/test_theme.py:43–53  ·  tests/test_theme.py::test_theme_stack
()

Source from the content-addressed store, hash-verified

41
42
43def test_theme_stack():
44 theme = Theme({class="st">"warning": class="st">"red"})
45 stack = ThemeStack(theme)
46 assert stack.get(class="st">"warning") == Style.parse(class="st">"red")
47 new_theme = Theme({class="st">"warning": class="st">"bold yellow"})
48 stack.push_theme(new_theme)
49 assert stack.get(class="st">"warning") == Style.parse(class="st">"bold yellow")
50 stack.pop_theme()
51 assert stack.get(class="st">"warning") == Style.parse(class="st">"red")
52 with pytest.raises(ThemeStackError):
53 stack.pop_theme()

Callers

nothing calls this directly

Calls 6

push_themeMethod · 0.95
pop_themeMethod · 0.95
ThemeClass · 0.90
ThemeStackClass · 0.90
getMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected