Skip to content

Commit da49129

Browse files
committed
fix
1 parent d4ef0a6 commit da49129

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/test_funcs.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
lazy_xp_function(sinc, static_argnames="xp")
4949

5050

51-
NUMPY_GE2 = int(np.__version__.split(".")[0]) >= 2
51+
NUMPY_VERSION = tuple(int(v) for v in np.__version__.split(".")[2])
5252

5353

5454
class TestApplyWhere:
@@ -224,7 +224,7 @@ def test_hypothesis( # type: ignore[explicit-any,decorated-any]
224224
):
225225
if (
226226
library in (Backend.NUMPY, Backend.NUMPY_READONLY)
227-
and not NUMPY_GE2
227+
and NUMPY_VERSION < (2, 0)
228228
and dtype is np.float32
229229
):
230230
pytest.xfail(reason="NumPy 1.x dtype promotion for scalars")
@@ -842,7 +842,11 @@ def test_all_equal(self, xp: ModuleType):
842842
@pytest.mark.xfail_xp_backend(
843843
Backend.SPARSE, reason="Non-compliant equal_nan=True behaviour"
844844
)
845-
def test_nan(self, xp: ModuleType):
845+
def test_nan(self, xp: ModuleType, library: Backend):
846+
is_numpy = library in (Backend.NUMPY, Backend.NUMPY_READONLY)
847+
if is_numpy and NUMPY_VERSION < (1, 24):
848+
pytest.xfail("NumPy <1.24 has no equal_nan kwarg in unique")
849+
846850
# Each NaN is counted separately
847851
a = xp.asarray([xp.nan, 123.0, xp.nan])
848852
xp_assert_equal(nunique(a), xp.asarray(3))

0 commit comments

Comments
 (0)