Skip to content

Commit c94a95f

Browse files
committed
Support for NumPy<2 (at least 1.26 series)
1 parent 281a1a9 commit c94a95f

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/blosc2/lazyexpr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
"max",
114114
"any",
115115
"all",
116-
"pow",
116+
"pow" if np.__version__.startswith("2.") else "power",
117117
"where",
118118
]
119119
functions += constructors

tests/ndarray/test_lazyexpr.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,6 +1144,10 @@ def test_get_expr_operands(expression, expected_operands):
11441144
assert blosc2.get_expr_operands(expression) == set(expected_operands)
11451145

11461146

1147+
@pytest.mark.skipif(
1148+
np.__version__.startswith("1."),
1149+
reason="NumPy < 2.0 has different casting rules"
1150+
)
11471151
@pytest.mark.parametrize(
11481152
"scalar",
11491153
[

tests/ndarray/test_lazyexpr_fields.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222
pytest.param((np.float64, np.float64), marks=pytest.mark.heavy),
2323
(np.int32, np.float32),
2424
(np.int32, np.uint32),
25-
(np.int8, np.int16),
25+
pytest.param((np.int8, np.int16), marks=pytest.mark.skipif(
26+
np.__version__.startswith("1."),
27+
reason="NumPy < 2.0 has different casting rules"
28+
)),
2629
# The next dtypes work, but running everything takes too much time
2730
pytest.param((np.int32, np.float64), marks=pytest.mark.heavy),
2831
pytest.param((np.int8, np.float64), marks=pytest.mark.heavy),

0 commit comments

Comments
 (0)