@@ -27,8 +27,12 @@ def validator_strict():
2727
2828@pytest .fixture
2929def validator_aok ():
30- return StringValidator ('prop' , 'parent' , array_ok = True , strict = True )
30+ return StringValidator ('prop' , 'parent' , array_ok = True , strict = False )
31+
3132
33+ @pytest .fixture
34+ def validator_aok_strict ():
35+ return StringValidator ('prop' , 'parent' , array_ok = True , strict = True )
3236
3337@pytest .fixture
3438def validator_aok_values ():
@@ -127,7 +131,8 @@ def test_acceptance_aok_scalars(val, validator_aok):
127131 ['foo' ,
128132 ['foo' ],
129133 np .array (['BAR' , '' ], dtype = 'object' ),
130- ['baz' , 'baz' , 'baz' ]])
134+ ['baz' , 'baz' , 'baz' ],
135+ ['foo' , None , 'bar' ]])
131136def test_acceptance_aok_list (val , validator_aok ):
132137 coerce_val = validator_aok .validate_coerce (val )
133138 if isinstance (val , np .ndarray ):
@@ -143,16 +148,19 @@ def test_acceptance_aok_list(val, validator_aok):
143148# ### Rejection by type ###
144149@pytest .mark .parametrize ('val' ,
145150 [['foo' , ()], ['foo' , 3 , 4 ], [3 , 2 , 1 ]])
146- def test_rejection_aok (val , validator_aok ):
151+ def test_rejection_aok (val , validator_aok_strict ):
147152 with pytest .raises (ValueError ) as validation_failure :
148- validator_aok .validate_coerce (val )
153+ validator_aok_strict .validate_coerce (val )
149154
150155 assert 'Invalid element(s)' in str (validation_failure .value )
151156
152157
153158# ### Rejection by value ###
154159@pytest .mark .parametrize ('val' ,
155- [['foo' , 'bar' ], ['3' , '4' ], ['BAR' , 'BAR' , 'hello!' ]])
160+ [['foo' , 'bar' ],
161+ ['3' , '4' ],
162+ ['BAR' , 'BAR' , 'hello!' ],
163+ ['foo' , None ]])
156164def test_rejection_aok_values (val , validator_aok_values ):
157165 with pytest .raises (ValueError ) as validation_failure :
158166 validator_aok_values .validate_coerce (val )
0 commit comments