|
| 1 | +From 9531e7ff00be577560f2cebf6739343646d3c770 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Tom Hunze <dev@thunze.de> |
| 3 | +Date: Mon, 23 Feb 2026 19:21:45 +0100 |
| 4 | +Subject: [PATCH] Use `np.isin` instead of `np.in1d` to fix numpy 2.4 test |
| 5 | + compatibility |
| 6 | + |
| 7 | +https://numpy.org/devdocs/release/2.4.0-notes.html#removed-numpy-in1d |
| 8 | +--- |
| 9 | + tests/test_optional/test_px/test_px.py | 2 +- |
| 10 | + tests/test_optional/test_px/test_px_functions.py | 2 +- |
| 11 | + 2 files changed, 2 insertions(+), 2 deletions(-) |
| 12 | + |
| 13 | +diff --git a/tests/test_optional/test_px/test_px.py b/tests/test_optional/test_px/test_px.py |
| 14 | +index 6c65925a727..a74c4680540 100644 |
| 15 | +--- a/tests/test_optional/test_px/test_px.py |
| 16 | ++++ b/tests/test_optional/test_px/test_px.py |
| 17 | +@@ -36,7 +36,7 @@ def test_custom_data_scatter(backend): |
| 18 | + ) |
| 19 | + for data in fig.data: |
| 20 | + assert np.all( |
| 21 | +- np.in1d(data.customdata[:, 1], iris.get_column("petal_width").to_numpy()) |
| 22 | ++ np.isin(data.customdata[:, 1], iris.get_column("petal_width").to_numpy()) |
| 23 | + ) |
| 24 | + # Hover and custom data, no repeated arguments |
| 25 | + fig = px.scatter( |
| 26 | +diff --git a/tests/test_optional/test_px/test_px_functions.py b/tests/test_optional/test_px/test_px_functions.py |
| 27 | +index 0814898f89d..8220ec7a33a 100644 |
| 28 | +--- a/tests/test_optional/test_px/test_px_functions.py |
| 29 | ++++ b/tests/test_optional/test_px/test_px_functions.py |
| 30 | +@@ -307,7 +307,7 @@ def test_sunburst_treemap_with_path_color(constructor): |
| 31 | + fig = px.sunburst( |
| 32 | + df.to_native(), path=path, color="sectors", color_discrete_map=cmap |
| 33 | + ) |
| 34 | +- assert np.all(np.in1d(fig.data[0].marker.colors, list(cmap.values()))) |
| 35 | ++ assert np.all(np.isin(fig.data[0].marker.colors, list(cmap.values()))) |
| 36 | + |
| 37 | + # Numerical column in path |
| 38 | + df = ( |
0 commit comments