3
3
import pytest
4
4
5
5
from zulipterminal .config .themes import (
6
- NEW_THEMES ,
7
6
THEMES ,
8
7
all_themes ,
9
8
complete_and_incomplete_themes ,
17
16
"gruvbox_dark" ,
18
17
"zt_light" ,
19
18
"zt_blue" ,
20
- "gruvbox_dark24" ,
21
19
}
22
20
23
21
@@ -32,11 +30,11 @@ def test_all_themes():
32
30
theme
33
31
if theme in expected_complete_themes
34
32
else pytest .param (theme , marks = pytest .mark .xfail (reason = "incomplete" ))
35
- for theme in NEW_THEMES
33
+ for theme in THEMES
36
34
],
37
35
)
38
- def test_new_builtin_theme_completeness (theme_name ):
39
- theme = NEW_THEMES [theme_name ]
36
+ def test_builtin_theme_completeness (theme_name ):
37
+ theme = THEMES [theme_name ]
40
38
theme_styles = theme .STYLES
41
39
theme_colors = theme .Color
42
40
@@ -53,55 +51,6 @@ def test_new_builtin_theme_completeness(theme_name):
53
51
assert fg in theme_colors and bg in theme_colors
54
52
55
53
56
- # Check built-in themes are complete for quality-control purposes
57
- @pytest .mark .parametrize (
58
- "theme_name" ,
59
- [
60
- theme
61
- if theme in expected_complete_themes
62
- else pytest .param (theme , marks = pytest .mark .xfail (reason = "incomplete" ))
63
- for theme in THEMES
64
- ],
65
- )
66
- def test_builtin_theme_completeness (theme_name ):
67
- theme = THEMES [theme_name ]
68
- styles_in_theme = {style [0 ] for style in theme }
69
-
70
- assert len (styles_in_theme ) == len (REQUIRED_STYLES )
71
- assert all (required_style in styles_in_theme for required_style in REQUIRED_STYLES )
72
-
73
-
74
- @pytest .mark .parametrize (
75
- "theme_name, depth" ,
76
- [
77
- ("zt_dark" , 16 ),
78
- ("zt_dark" , 256 ),
79
- ("zt_light" , 16 ),
80
- ("zt_blue" , 16 ),
81
- ("gruvbox_dark" , 16 ),
82
- ("gruvbox_dark" , 256 ),
83
- ("gruvbox_dark24" , 2 ** 24 ),
84
- ("gruvbox_dark24" , 2 ** 24 ),
85
- ],
86
- )
87
- def test_migrated_themes (theme_name , depth ):
88
- def split_and_strip (style ):
89
- style = style .split ("," )
90
- style = [s .strip () for s in style ]
91
- return style
92
-
93
- old_theme = THEMES [theme_name ]
94
- new_theme = generate_theme (theme_name .replace ("24" , "" ), depth )
95
- for new_style , old_style in zip (new_theme , old_theme ):
96
- assert new_style [0 ] == old_style [0 ]
97
- if depth == 16 :
98
- assert split_and_strip (new_style [1 ]) == split_and_strip (old_style [1 ])
99
- assert split_and_strip (new_style [2 ]) == split_and_strip (old_style [2 ])
100
- else :
101
- assert split_and_strip (new_style [4 ]) == split_and_strip (old_style [4 ])
102
- assert split_and_strip (new_style [5 ]) == split_and_strip (old_style [5 ])
103
-
104
-
105
54
def test_complete_and_incomplete_themes ():
106
55
# These are sorted to ensure reproducibility
107
56
result = (
@@ -157,7 +106,7 @@ class Color(Enum):
157
106
],
158
107
)
159
108
def test_generate_theme (mocker , color_depth , expected_urwid_theme ):
160
- mocker .patch .dict ("zulipterminal.config.themes.NEW_THEMES " , {"theme" : theme })
109
+ mocker .patch .dict ("zulipterminal.config.themes.THEMES " , {"theme" : theme })
161
110
req_styles = {"s1" : "" , "s2" : "bold" }
162
111
mocker .patch .dict ("zulipterminal.themes.Common.REQUIRED_STYLES" , req_styles )
163
112
assert generate_theme ("theme" , color_depth ) == expected_urwid_theme
0 commit comments