@@ -34,7 +34,11 @@ def validator_aok(request):
34
34
35
35
@pytest .fixture
36
36
def validator_extras ():
37
- return IntegerValidator ("prop" , "parent" , extras = ['normal' , 'bold' ])
37
+ return IntegerValidator ("prop" , "parent" , min = - 2 , max = 10 , extras = ['normal' , 'bold' ])
38
+
39
+ @pytest .fixture
40
+ def validator_extras_aok ():
41
+ return IntegerValidator ("prop" , "parent" , min = - 2 , max = 10 , array_ok = True , extras = [['normal' , 'bold' ], ['italics' ]])
38
42
39
43
# ### Acceptance ###
40
44
@pytest .mark .parametrize ("val" , [1 , - 19 , 0 , - 1234 ])
@@ -60,12 +64,17 @@ def test_acceptance_min_max(val, validator_min_max):
60
64
assert validator_min_max .validate_coerce (val ) == approx (val )
61
65
62
66
# With extras
63
- @pytest .mark .parametrize ("val" , ['normal' , 'bold' ])
67
+ @pytest .mark .parametrize ("val" , ['normal' , 'bold' , 10 , - 2 ])
64
68
def test_acceptance_extras (val , validator_extras ):
65
69
assert validator_extras .validate_coerce (val ) == val
66
70
71
+ # Test extras for array_ok
72
+ @pytest .mark .parametrize ("val" , [['normal' , 'bold' ], ['italics' ]])
73
+ def test_acceptance_extras_array (val , validator_extras_aok ):
74
+ assert validator_extras_aok .validate_coerce (val ) == val
75
+
67
76
# Test rejection by extras
68
- @pytest .mark .parametrize ("val" , ['italic' , 'bolditalic' ])
77
+ @pytest .mark .parametrize ("val" , ['italic' , 'bolditalic' , - 3 , 11 ])
69
78
def test_rejection_extras (val , validator_extras ):
70
79
with pytest .raises (ValueError ) as validation_failure :
71
80
validator_extras .validate_coerce (val )
0 commit comments