Skip to content

Commit cef18a9

Browse files
committed
Separate test for coercion of geo1 to geo and legend1 to legend
1 parent b809b46 commit cef18a9

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

tests/test_plotly_utils/validators/test_subplotid_validator.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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()])
3339
def 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
)
6471
def 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()])
7487
def test_rejection_type_aok(val, validator_aok):

0 commit comments

Comments
 (0)