Skip to content

Commit 2461bc7

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

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tests/test_plotly_utils/validators/test_subplotid_validator.py

Lines changed: 12 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,7 @@ def test_rejection_value(val, validator):
5965

6066

6167
@pytest.mark.parametrize(
62-
"val", ["legend2", ["legend", "legend2"], ("legend1", "legend2")]
68+
"val", ["legend2", ["legend", "legend2"], ["legend", "legend2"]],
6369
)
6470
def test_acceptance_aok(val, validator_aok):
6571
v = validator_aok.validate_coerce(val)
@@ -68,6 +74,11 @@ def test_acceptance_aok(val, validator_aok):
6874
else:
6975
assert val == v
7076

77+
# Coercion from {base}1 to {base}
78+
def test_coerce_aok(validator_aok):
79+
v = validator_aok.validate_coerce(("legend1", "legend2"))
80+
assert ("legend", "legend2") == tuple(v)
81+
7182

7283
# Rejection by type
7384
@pytest.mark.parametrize("val", [23, [2, 3], {}, set(), np_inf(), np_nan()])

0 commit comments

Comments
 (0)