@@ -31,10 +31,7 @@ def validator_aok_colorscale():
31
31
['red' , 'BLUE' , 'rgb(255, 0, 0)' , 'hsl(0, 100%, 50%)' , 'hsla(0, 100%, 50%, 100%)' ,
32
32
'hsv(0, 100%, 100%)' , 'hsva(0, 100%, 100%, 50%)' ])
33
33
def test_acceptance (val , validator : ColorValidator ):
34
- if isinstance (val , str ):
35
- assert validator .validate_coerce (val ) == str .replace (val .lower (), ' ' , '' )
36
- else :
37
- assert validator .validate_coerce (val ) == val
34
+ assert validator .validate_coerce (val ) == val
38
35
39
36
40
37
# ### Rejection by type ###
@@ -64,10 +61,7 @@ def test_rejection(val, validator: ColorValidator):
64
61
['red' , 'BLUE' , 23 , 15 , 'rgb(255, 0, 0)' , 'hsl(0, 100%, 50%)' , 'hsla(0, 100%, 50%, 100%)' ,
65
62
'hsv(0, 100%, 100%)' , 'hsva(0, 100%, 100%, 50%)' ])
66
63
def test_acceptance_colorscale (val , validator_colorscale : ColorValidator ):
67
- if isinstance (val , str ):
68
- assert validator_colorscale .validate_coerce (val ) == str .replace (val .lower (), ' ' , '' )
69
- else :
70
- assert validator_colorscale .validate_coerce (val ) == val
64
+ assert validator_colorscale .validate_coerce (val ) == val
71
65
72
66
73
67
# ### Rejection by type ###
@@ -100,14 +94,11 @@ def test_rejection_colorscale(val, validator_colorscale: ColorValidator):
100
94
['hsva(0, 100%, 100%, 50%)' ]])
101
95
def test_acceptance_aok (val , validator_aok : ColorValidator ):
102
96
coerce_val = validator_aok .validate_coerce (val )
97
+
103
98
if isinstance (val , (list , np .ndarray )):
104
- expected = np .array (
105
- [str .replace (v .lower (), ' ' , '' ) if isinstance (v , str ) else v for v in val ],
106
- dtype = coerce_val .dtype )
107
- assert np .array_equal (coerce_val , expected )
99
+ assert np .array_equal (coerce_val , val )
108
100
else :
109
- expected = str .replace (val .lower (), ' ' , '' ) if isinstance (val , str ) else val
110
- assert coerce_val == expected
101
+ assert coerce_val == val
111
102
112
103
113
104
# ### Rejection ###
@@ -134,13 +125,9 @@ def test_rejection_aok(val, validator_aok: ColorValidator):
134
125
def test_acceptance_aok_colorscale (val , validator_aok_colorscale : ColorValidator ):
135
126
coerce_val = validator_aok_colorscale .validate_coerce (val )
136
127
if isinstance (val , (list , np .ndarray )):
137
- expected = np .array (
138
- [str .replace (v .lower (), ' ' , '' ) if isinstance (v , str ) else v for v in val ],
139
- dtype = coerce_val .dtype )
140
- assert np .array_equal (coerce_val , expected )
128
+ assert np .array_equal (list (coerce_val ), val )
141
129
else :
142
- expected = str .replace (val .lower (), ' ' , '' ) if isinstance (val , str ) else val
143
- assert coerce_val == expected
130
+ assert coerce_val == val
144
131
145
132
146
133
# ### Rejection ###
0 commit comments