3
3
from rich .style import Style
4
4
5
5
from cmd2 import (
6
- ColorName ,
6
+ Color ,
7
7
rich_utils ,
8
8
)
9
9
from cmd2 import (
@@ -59,7 +59,7 @@ def test_align_left_wide_text() -> None:
59
59
def test_align_left_with_style () -> None :
60
60
character = '-'
61
61
62
- styled_text = su .stylize ('table' , style = ColorName .BRIGHT_BLUE )
62
+ styled_text = su .stylize ('table' , style = Color .BRIGHT_BLUE )
63
63
width = 8
64
64
65
65
aligned = su .align_left (styled_text , width = width , character = character )
@@ -85,7 +85,7 @@ def test_align_center_wide_text() -> None:
85
85
def test_align_center_with_style () -> None :
86
86
character = '-'
87
87
88
- styled_text = su .stylize ('table' , style = ColorName .BRIGHT_BLUE )
88
+ styled_text = su .stylize ('table' , style = Color .BRIGHT_BLUE )
89
89
width = 8
90
90
91
91
aligned = su .align_center (styled_text , width = width , character = character )
@@ -111,7 +111,7 @@ def test_align_right_wide_text() -> None:
111
111
def test_align_right_with_style () -> None :
112
112
character = '-'
113
113
114
- styled_text = su .stylize ('table' , style = ColorName .BRIGHT_BLUE )
114
+ styled_text = su .stylize ('table' , style = Color .BRIGHT_BLUE )
115
115
width = 8
116
116
117
117
aligned = su .align_right (styled_text , width = width , character = character )
@@ -122,8 +122,8 @@ def test_stylize() -> None:
122
122
styled_str = su .stylize (
123
123
HELLO_WORLD ,
124
124
style = Style (
125
- color = ColorName .GREEN ,
126
- bgcolor = ColorName .BLUE ,
125
+ color = Color .GREEN ,
126
+ bgcolor = Color .BLUE ,
127
127
bold = True ,
128
128
underline = True ,
129
129
),
@@ -134,15 +134,15 @@ def test_stylize() -> None:
134
134
135
135
def test_strip_style () -> None :
136
136
base_str = HELLO_WORLD
137
- styled_str = su .stylize (base_str , style = ColorName .GREEN )
137
+ styled_str = su .stylize (base_str , style = Color .GREEN )
138
138
assert base_str != styled_str
139
139
assert base_str == su .strip_style (styled_str )
140
140
141
141
142
142
def test_str_width () -> None :
143
143
# Include a full-width character
144
144
base_str = HELLO_WORLD + "深"
145
- styled_str = su .stylize (base_str , style = ColorName .GREEN )
145
+ styled_str = su .stylize (base_str , style = Color .GREEN )
146
146
expected_width = len (HELLO_WORLD ) + 2
147
147
assert su .str_width (base_str ) == su .str_width (styled_str ) == expected_width
148
148
0 commit comments