|
16 | 16 | "gruvbox_dark",
|
17 | 17 | "zt_light",
|
18 | 18 | "zt_blue",
|
19 |
| - "gruvbox_dark24", |
20 | 19 | }
|
21 | 20 |
|
22 | 21 |
|
23 | 22 | def test_all_themes():
|
24 | 23 | assert all_themes() == list(THEMES.keys())
|
25 | 24 |
|
26 | 25 |
|
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 |
| - |
76 | 26 | def test_complete_and_incomplete_themes():
|
77 | 27 | # These are sorted to ensure reproducibility
|
78 | 28 | result = (
|
@@ -128,7 +78,7 @@ class Color(Enum):
|
128 | 78 | ],
|
129 | 79 | )
|
130 | 80 | 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}) |
132 | 82 | req_styles = {"s1": "", "s2": "bold"}
|
133 | 83 | mocker.patch.dict("zulipterminal.themes._template.REQUIRED_STYLES", req_styles)
|
134 | 84 | assert generate_theme("theme", color_depth) == expected_urwid_theme
|
0 commit comments