Skip to content

Commit 75ac930

Browse files
committed
Black formatting
1 parent 223c5cc commit 75ac930

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

packages/python/plotly/_plotly_utils/basevalidators.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,8 @@ def validate_coerce(self, v):
950950
invalid_els = [
951951
e
952952
for e in v
953-
if not (isinstance(e, int) and 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)
954+
and e not in self.extras
954955
]
955956

956957
if invalid_els:

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,18 @@ def validator_max():
3232
def validator_aok(request):
3333
return IntegerValidator("prop", "parent", min=-2, max=10, array_ok=True)
3434

35+
3536
@pytest.fixture
3637
def validator_extras():
37-
return IntegerValidator("prop", "parent", min=-2, max=10, extras=['normal', 'bold'])
38+
return IntegerValidator("prop", "parent", min=-2, max=10, extras=["normal", "bold"])
39+
3840

3941
@pytest.fixture
4042
def validator_extras_aok():
41-
return IntegerValidator("prop", "parent", min=-2, max=10, array_ok=True, extras=['normal', 'bold'])
43+
return IntegerValidator(
44+
"prop", "parent", min=-2, max=10, array_ok=True, extras=["normal", "bold"]
45+
)
46+
4247

4348
# ### Acceptance ###
4449
@pytest.mark.parametrize("val", [1, -19, 0, -1234])
@@ -63,24 +68,28 @@ def test_rejection_by_value(val, validator):
6368
def test_acceptance_min_max(val, validator_min_max):
6469
assert validator_min_max.validate_coerce(val) == approx(val)
6570

71+
6672
# With extras
67-
@pytest.mark.parametrize("val", ['normal', 'bold', 10, -2])
73+
@pytest.mark.parametrize("val", ["normal", "bold", 10, -2])
6874
def test_acceptance_extras(val, validator_extras):
6975
assert validator_extras.validate_coerce(val) == val
7076

77+
7178
# Test extras for array_ok
72-
@pytest.mark.parametrize("val", [[10, 'normal', 'bold'], ['normal'], [10, -2], [5]])
79+
@pytest.mark.parametrize("val", [[10, "normal", "bold"], ["normal"], [10, -2], [5]])
7380
def test_acceptance_extras_array(val, validator_extras_aok):
7481
assert validator_extras_aok.validate_coerce(val) == val
7582

83+
7684
# Test rejection by extras
77-
@pytest.mark.parametrize("val", ['invalid value', 'different invalid value', -3, 11])
85+
@pytest.mark.parametrize("val", ["invalid value", "different invalid value", -3, 11])
7886
def test_rejection_extras(val, validator_extras):
7987
with pytest.raises(ValueError) as validation_failure:
8088
validator_extras.validate_coerce(val)
8189

8290
assert "Invalid value" in str(validation_failure.value)
8391

92+
8493
@pytest.mark.parametrize(
8594
"val", [-1.01, -10, 2.1, 3, np.iinfo(int).max, np.iinfo(int).min]
8695
)

0 commit comments

Comments
 (0)