Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 04737d1

Browse files
authored
Merge branch 'master' into np2
2 parents 408f3de + 50e31d3 commit 04737d1

File tree

5 files changed

+77
-1
lines changed

5 files changed

+77
-1
lines changed

‎.circleci/config.yml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,21 @@ jobs:
234234
- test_optional:
235235
py: "39_pandas_2"
236236

237+
# No numpy
238+
python_312_no_numpy:
239+
docker:
240+
- image: cimg/python:3.12-browsers
241+
steps:
242+
- run:
243+
name: Check that numpy is not installed
244+
command: |
245+
if pip list | grep numpy > /dev/null 2>&1
246+
then exit 1
247+
else exit 0
248+
fi
249+
- test_optional:
250+
py: "312_no_numpy"
251+
237252
# Orca
238253
python_38_orca:
239254
docker:
@@ -598,5 +613,6 @@ workflows:
598613
- python_39_pandas_2_optional
599614
- python_38_orca
600615
- python_39_percy
616+
- python_312_no_numpy
601617
- build-doc
602618

‎CHANGELOG.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## UNRELEASED
6+
7+
### Updated
8+
- Fixed a bug in integer validation of arrays that threw an error when an array contained a mix of strings and integers.
9+
510
## [5.23.0] - 2024年07月23日
611

712
### Updated

‎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 (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: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,18 @@ def validator_aok(request):
3333
return IntegerValidator("prop", "parent", min=-2, max=10, array_ok=True)
3434

3535

36+
@pytest.fixture
37+
def validator_extras():
38+
return IntegerValidator("prop", "parent", min=-2, max=10, extras=["normal", "bold"])
39+
40+
41+
@pytest.fixture
42+
def validator_extras_aok():
43+
return IntegerValidator(
44+
"prop", "parent", min=-2, max=10, array_ok=True, extras=["normal", "bold"]
45+
)
46+
47+
3648
# ### Acceptance ###
3749
@pytest.mark.parametrize("val", [1, -19, 0, -1234])
3850
def test_acceptance(val, validator):
@@ -57,6 +69,27 @@ def test_acceptance_min_max(val, validator_min_max):
5769
assert validator_min_max.validate_coerce(val) == approx(val)
5870

5971

72+
# With extras
73+
@pytest.mark.parametrize("val", ["normal", "bold", 10, -2])
74+
def test_acceptance_extras(val, validator_extras):
75+
assert validator_extras.validate_coerce(val) == val
76+
77+
78+
# Test extras for array_ok
79+
@pytest.mark.parametrize("val", [[10, "normal", "bold"], ["normal"], [10, -2], [5]])
80+
def test_acceptance_extras_array(val, validator_extras_aok):
81+
assert validator_extras_aok.validate_coerce(val) == val
82+
83+
84+
# Test rejection by extras
85+
@pytest.mark.parametrize("val", ["invalid value", "different invalid value", -3, 11])
86+
def test_rejection_extras(val, validator_extras):
87+
with pytest.raises(ValueError) as validation_failure:
88+
validator_extras.validate_coerce(val)
89+
90+
assert "Invalid value" in str(validation_failure.value)
91+
92+
6093
@pytest.mark.parametrize(
6194
"val", [-1.01, -10, 2.1, 3, np.iinfo(int).max, np.iinfo(int).min]
6295
)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
requests==2.31.0
2+
tenacity==8.2.3
3+
pandas
4+
xarray==2023120
5+
statsmodels
6+
Pillow==10.2.0
7+
pytest==7.4.4
8+
pytz==2023.3.post1
9+
ipython[all]==7.22.0
10+
ipywidgets<8
11+
ipykernel==5.5.3
12+
jupyter==1.0.0
13+
scipy==1.11.4
14+
Shapely==2.0.2
15+
geopandas==0.14.2
16+
pyshp==2.3.1
17+
matplotlib==3.8.2
18+
scikit-image==0.22.0
19+
psutil==5.9.7
20+
kaleido
21+
orjson==3.9.10

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /