Skip to content

Commit 3f13e9a

Browse files
committed
Fix bug and update test
1 parent ff56b21 commit 3f13e9a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/python/plotly/_plotly_utils/basevalidators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ def validate_coerce(self, v):
950950
invalid_els = [
951951
e
952952
for e in v
953-
if not (self.min_val <= e <= self.max_val) and e not in self.extras
953+
if not (isinstance(e, int) and self.min_val <= e <= self.max_val) and e not in self.extras
954954
]
955955

956956
if invalid_els:

packages/python/plotly/_plotly_utils/tests/validators/test_integer_validator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def validator_extras():
3838

3939
@pytest.fixture
4040
def validator_extras_aok():
41-
return IntegerValidator("prop", "parent", min=-2, max=10, array_ok=True, extras=[['normal', 'bold'], ['italics']])
41+
return IntegerValidator("prop", "parent", min=-2, max=10, array_ok=True, extras=['normal', 'bold', 'italics'])
4242

4343
# ### Acceptance ###
4444
@pytest.mark.parametrize("val", [1, -19, 0, -1234])
@@ -69,7 +69,7 @@ def test_acceptance_extras(val, validator_extras):
6969
assert validator_extras.validate_coerce(val) == val
7070

7171
# Test extras for array_ok
72-
@pytest.mark.parametrize("val", [['normal', 'bold'], ['italics']])
72+
@pytest.mark.parametrize("val", [[10, 'normal', 'bold'], ['italics'], [10, -2], [5]])
7373
def test_acceptance_extras_array(val, validator_extras_aok):
7474
assert validator_extras_aok.validate_coerce(val) == val
7575

0 commit comments

Comments
 (0)