Skip to content

Commit a24c431

Browse files
committed
theme: Delete old themes.
Old theme format used in themes.py is deleted from this commit. ZT_THEMES is changed to THEMES. `complete_and_incomplete_themes` is edited to make it use the new THEMES instead of the old one. The old theme completeness test is also removed.
1 parent 5a3e20c commit a24c431

File tree

2 files changed

+10
-511
lines changed

2 files changed

+10
-511
lines changed

tests/config/test_themes.py

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -16,63 +16,13 @@
1616
"gruvbox_dark",
1717
"zt_light",
1818
"zt_blue",
19-
"gruvbox_dark24",
2019
}
2120

2221

2322
def test_all_themes():
2423
assert all_themes() == list(THEMES.keys())
2524

2625

27-
# Check built-in themes are complete for quality-control purposes
28-
@pytest.mark.parametrize(
29-
"theme_name",
30-
[
31-
theme
32-
if theme in expected_complete_themes
33-
else pytest.param(theme, marks=pytest.mark.xfail(reason="incomplete"))
34-
for theme in THEMES
35-
],
36-
)
37-
def test_builtin_theme_completeness(theme_name):
38-
theme = THEMES[theme_name]
39-
styles_in_theme = {style[0] for style in theme}
40-
41-
assert len(styles_in_theme) >= len(REQUIRED_STYLES)
42-
assert all(required_style in styles_in_theme for required_style in REQUIRED_STYLES)
43-
44-
45-
@pytest.mark.parametrize(
46-
"theme_name, depth",
47-
[
48-
("zt_dark", 16),
49-
("zt_dark", 256),
50-
("zt_light", 16),
51-
("zt_blue", 16),
52-
("gruvbox_dark", 16),
53-
("gruvbox_dark", 256),
54-
("gruvbox_dark24", 2 ** 24),
55-
("gruvbox_dark24", 2 ** 24),
56-
],
57-
)
58-
def test_migrated_themes(theme_name, depth):
59-
def split_and_strip(style):
60-
style = style.split(",")
61-
style = [s.strip() for s in style]
62-
return style
63-
64-
old_theme = THEMES[theme_name]
65-
new_theme = generate_theme(theme_name.replace("24", ""), depth)
66-
for new_style, old_style in zip(new_theme, old_theme):
67-
assert new_style[0] == old_style[0]
68-
if depth == 16:
69-
assert split_and_strip(new_style[1]) == split_and_strip(old_style[1])
70-
assert split_and_strip(new_style[2]) == split_and_strip(old_style[2])
71-
else:
72-
assert split_and_strip(new_style[4]) == split_and_strip(old_style[4])
73-
assert split_and_strip(new_style[5]) == split_and_strip(old_style[5])
74-
75-
7626
def test_complete_and_incomplete_themes():
7727
# These are sorted to ensure reproducibility
7828
result = (
@@ -128,7 +78,7 @@ class Color(Enum):
12878
],
12979
)
13080
def test_generate_theme(mocker, color_depth, expected_urwid_theme):
131-
mocker.patch.dict("zulipterminal.config.themes.ZT_THEMES", {"theme": theme})
81+
mocker.patch.dict("zulipterminal.config.themes.THEMES", {"theme": theme})
13282
req_styles = {"s1": "", "s2": "bold"}
13383
mocker.patch.dict("zulipterminal.themes._template.REQUIRED_STYLES", req_styles)
13484
assert generate_theme("theme", color_depth) == expected_urwid_theme

0 commit comments

Comments
 (0)