Fix pytest9 and numpy2 deprecations by taranarmo · Pull Request #5524 · plotly/plotly.py · GitHub
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
10 changes: 6 additions & 4 deletions plotly/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import os
from pathlib import Path


def pytest_ignore_collect(path):
def pytest_ignore_collect(collection_path: Path):
# Ignored files, most of them are raising a chart studio error
ignored_paths = [
"exploding_module.py",
Expand All @@ -16,9 +17,10 @@ def pytest_ignore_collect(path):
"presentation_objs.py",
"session.py",
]
path_str = str(collection_path)
if (
os.path.basename(str(path)) in ignored_paths
or "plotly/plotly/plotly/__init__.py" in str(path)
or "plotly/api/utils.py" in str(path)
collection_path.name in ignored_paths
or "plotly/plotly/plotly/__init__.py" in path_str
or "plotly/api/utils.py" in path_str
):
return True
6 changes: 3 additions & 3 deletions plotly/figure_factory/_violin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ def calc_stats(data):
x = np.asarray(data, float)
vals_min = np.min(x)
vals_max = np.max(x)
q2 = np.percentile(x, 50, interpolation="linear")
q1 = np.percentile(x, 25, interpolation="lower")
q3 = np.percentile(x, 75, interpolation="higher")
q2 = np.percentile(x, 50, method="linear")
q1 = np.percentile(x, 25, method="lower")
q3 = np.percentile(x, 75, method="higher")
iqr = q3 - q1
whisker_dist = 1.5 * iqr

Expand Down
2 changes: 1 addition & 1 deletion tests/test_optional/test_px/test_px.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_custom_data_scatter(backend):
)
for data in fig.data:
assert np.all(
np.in1d(data.customdata[:, 1], iris.get_column("petal_width").to_numpy())
np.isin(data.customdata[:, 1], iris.get_column("petal_width").to_numpy())
)
# Hover and custom data, no repeated arguments
fig = px.scatter(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_optional/test_px/test_px_functions.py