@@ -28,6 +28,12 @@ def test_acceptance(val, validator):
2828 assert validator .validate_coerce (val ) == val
2929
3030
31+ # Coercion from {base}1 to {base}
32+ def test_coerce (validator ):
33+ v = validator .validate_coerce ("geo1" )
34+ assert ("geo" ) == v
35+
36+
3137# Rejection by type
3238@pytest .mark .parametrize ("val" , [23 , [], {}, set (), np_inf (), np_nan ()])
3339def test_rejection_type (val , validator ):
@@ -59,7 +65,8 @@ def test_rejection_value(val, validator):
5965
6066
6167@pytest .mark .parametrize (
62- "val" , ["legend2" , ["legend" , "legend2" ], ("legend1" , "legend2" )]
68+ "val" ,
69+ ["legend2" , ["legend" , "legend2" ], ["legend" , "legend2" ]],
6370)
6471def test_acceptance_aok (val , validator_aok ):
6572 v = validator_aok .validate_coerce (val )
@@ -69,6 +76,12 @@ def test_acceptance_aok(val, validator_aok):
6976 assert val == v
7077
7178
79+ # Coercion from {base}1 to {base}
80+ def test_coerce_aok (validator_aok ):
81+ v = validator_aok .validate_coerce (("legend1" , "legend2" ))
82+ assert ("legend" , "legend2" ) == tuple (v )
83+
84+
7285# Rejection by type
7386@pytest .mark .parametrize ("val" , [23 , [2 , 3 ], {}, set (), np_inf (), np_nan ()])
7487def test_rejection_type_aok (val , validator_aok ):
0 commit comments