@@ -30,14 +30,14 @@ def validator_aok_colorscale():
30
30
@pytest .mark .parametrize ('val' ,
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
- def test_acceptance (val , validator : ColorValidator ):
33
+ def test_acceptance (val , validator ):
34
34
assert validator .validate_coerce (val ) == val
35
35
36
36
37
37
# ### Rejection by type ###
38
38
@pytest .mark .parametrize ('val' ,
39
39
[set (), 23 , 0.5 , {}, ['red' ], [12 ]])
40
- def test_rejection (val , validator : ColorValidator ):
40
+ def test_rejection (val , validator ):
41
41
with pytest .raises (ValueError ) as validation_failure :
42
42
validator .validate_coerce (val )
43
43
@@ -47,7 +47,7 @@ def test_rejection(val, validator: ColorValidator):
47
47
# ### Rejection by value ###
48
48
@pytest .mark .parametrize ('val' ,
49
49
['redd' , 'rgbbb(255, 0, 0)' , 'hsl(0, 1%0000%, 50%)' ])
50
- def test_rejection (val , validator : ColorValidator ):
50
+ def test_rejection (val , validator ):
51
51
with pytest .raises (ValueError ) as validation_failure :
52
52
validator .validate_coerce (val )
53
53
@@ -60,14 +60,14 @@ def test_rejection(val, validator: ColorValidator):
60
60
@pytest .mark .parametrize ('val' ,
61
61
['red' , 'BLUE' , 23 , 15 , 'rgb(255, 0, 0)' , 'hsl(0, 100%, 50%)' , 'hsla(0, 100%, 50%, 100%)' ,
62
62
'hsv(0, 100%, 100%)' , 'hsva(0, 100%, 100%, 50%)' ])
63
- def test_acceptance_colorscale (val , validator_colorscale : ColorValidator ):
63
+ def test_acceptance_colorscale (val , validator_colorscale ):
64
64
assert validator_colorscale .validate_coerce (val ) == val
65
65
66
66
67
67
# ### Rejection by type ###
68
68
@pytest .mark .parametrize ('val' ,
69
69
[set (), {}, ['red' ], [12 ]])
70
- def test_rejection_colorscale (val , validator_colorscale : ColorValidator ):
70
+ def test_rejection_colorscale (val , validator_colorscale ):
71
71
with pytest .raises (ValueError ) as validation_failure :
72
72
validator_colorscale .validate_coerce (val )
73
73
@@ -77,7 +77,7 @@ def test_rejection_colorscale(val, validator_colorscale: ColorValidator):
77
77
# ### Rejection by value ###
78
78
@pytest .mark .parametrize ('val' ,
79
79
['redd' , 'rgbbb(255, 0, 0)' , 'hsl(0, 1%0000%, 50%)' ])
80
- def test_rejection_colorscale (val , validator_colorscale : ColorValidator ):
80
+ def test_rejection_colorscale (val , validator_colorscale ):
81
81
with pytest .raises (ValueError ) as validation_failure :
82
82
validator_colorscale .validate_coerce (val )
83
83
@@ -94,7 +94,7 @@ def test_rejection_colorscale(val, validator_colorscale: ColorValidator):
94
94
['hsl(0, 100%, 50%)' , 'hsla(0, 100%, 50%, 100%)' , 'hsv(0, 100%, 100%)' ],
95
95
np .array (['hsl(0, 100%, 50%)' , 'hsla(0, 100%, 50%, 100%)' , 'hsv(0, 100%, 100%)' ]),
96
96
['hsva(0, 100%, 100%, 50%)' ]])
97
- def test_acceptance_aok (val , validator_aok : ColorValidator ):
97
+ def test_acceptance_aok (val , validator_aok ):
98
98
coerce_val = validator_aok .validate_coerce (val )
99
99
100
100
if isinstance (val , np .ndarray ):
@@ -111,7 +111,7 @@ def test_acceptance_aok(val, validator_aok: ColorValidator):
111
111
[['red' , 'rgb(255, 0, 0)' ], ['hsl(0, 100%, 50%)' , 'hsla(0, 100%, 50%, 100%)' ]],
112
112
np .array ([['red' , 'rgb(255, 0, 0)' ], ['hsl(0, 100%, 50%)' , 'hsla(0, 100%, 50%, 100%)' ]])
113
113
])
114
- def test_acceptance_aok_2D (val , validator_aok : ColorValidator ):
114
+ def test_acceptance_aok_2D (val , validator_aok ):
115
115
coerce_val = validator_aok .validate_coerce (val )
116
116
117
117
if isinstance (val , np .ndarray ):
@@ -128,7 +128,7 @@ def test_acceptance_aok_2D(val, validator_aok: ColorValidator):
128
128
['redd' , 'rgb(255, 0, 0)' ],
129
129
['hsl(0, 100%, 50_00%)' , 'hsla(0, 100%, 50%, 100%)' , 'hsv(0, 100%, 100%)' ],
130
130
['hsva(0, 1%00%, 100%, 50%)' ]])
131
- def test_rejection_aok (val , validator_aok : ColorValidator ):
131
+ def test_rejection_aok (val , validator_aok ):
132
132
with pytest .raises (ValueError ) as validation_failure :
133
133
validator_aok .validate_coerce (val )
134
134
@@ -142,7 +142,7 @@ def test_rejection_aok(val, validator_aok: ColorValidator):
142
142
[np .array (['hsl(0, 100%, 50_00%)' , 'hsla(0, 100%, 50%, 100%)' ]),
143
143
np .array (['hsv(0, 100%, 100%)' , 'purple' ])],
144
144
[['blue' ], [2 ]]])
145
- def test_rejection_aok_2D (val , validator_aok : ColorValidator ):
145
+ def test_rejection_aok_2D (val , validator_aok ):
146
146
with pytest .raises (ValueError ) as validation_failure :
147
147
validator_aok .validate_coerce (val )
148
148
@@ -157,7 +157,7 @@ def test_rejection_aok_2D(val, validator_aok: ColorValidator):
157
157
['red' , 0.5 , 'rgb(255, 0, 0)' ],
158
158
['hsl(0, 100%, 50%)' , 'hsla(0, 100%, 50%, 100%)' , 'hsv(0, 100%, 100%)' ],
159
159
['hsva(0, 100%, 100%, 50%)' ]])
160
- def test_acceptance_aok_colorscale (val , validator_aok_colorscale : ColorValidator ):
160
+ def test_acceptance_aok_colorscale (val , validator_aok_colorscale ):
161
161
coerce_val = validator_aok_colorscale .validate_coerce (val )
162
162
if isinstance (val , (list , np .ndarray )):
163
163
assert np .array_equal (list (coerce_val ), val )
@@ -170,7 +170,7 @@ def test_acceptance_aok_colorscale(val, validator_aok_colorscale: ColorValidator
170
170
[['redd' , 0.5 , 'rgb(255, 0, 0)' ],
171
171
['hsl(0, 100%, 50_00%)' , 'hsla(0, 100%, 50%, 100%)' , 'hsv(0, 100%, 100%)' ],
172
172
['hsva(0, 1%00%, 100%, 50%)' ]])
173
- def test_rejection_aok_colorscale (val , validator_aok_colorscale : ColorValidator ):
173
+ def test_rejection_aok_colorscale (val , validator_aok_colorscale ):
174
174
with pytest .raises (ValueError ) as validation_failure :
175
175
validator_aok_colorscale .validate_coerce (val )
176
176
@@ -180,25 +180,25 @@ def test_rejection_aok_colorscale(val, validator_aok_colorscale: ColorValidator)
180
180
# Description
181
181
# -----------
182
182
# Test dynamic description logic
183
- def test_description (validator : ColorValidator ):
183
+ def test_description (validator ):
184
184
desc = validator .description ()
185
185
assert 'A number that will be interpreted as a color' not in desc
186
186
assert 'A list or array of any of the above' not in desc
187
187
188
188
189
- def test_description_aok (validator_aok : ColorValidator ):
189
+ def test_description_aok (validator_aok ):
190
190
desc = validator_aok .description ()
191
191
assert 'A number that will be interpreted as a color' not in desc
192
192
assert 'A list or array of any of the above' in desc
193
193
194
194
195
- def test_description_aok (validator_colorscale : ColorValidator ):
195
+ def test_description_aok (validator_colorscale ):
196
196
desc = validator_colorscale .description ()
197
197
assert 'A number that will be interpreted as a color' in desc
198
198
assert 'A list or array of any of the above' not in desc
199
199
200
200
201
- def test_description_aok_colorscale (validator_aok_colorscale : ColorValidator ):
201
+ def test_description_aok_colorscale (validator_aok_colorscale ):
202
202
desc = validator_aok_colorscale .description ()
203
203
assert 'A number that will be interpreted as a color' in desc
204
204
assert 'A list or array of any of the above' in desc
0 commit comments