diff --git a/dpnp/tests/test_search.py b/dpnp/tests/test_search.py index 75ce9bdeed2..493c1edce2d 100644 --- a/dpnp/tests/test_search.py +++ b/dpnp/tests/test_search.py @@ -9,6 +9,7 @@ generate_random_numpy_array, get_all_dtypes, ) +from .third_party.cupy import testing @pytest.mark.parametrize("func", ["argmax", "argmin"]) @@ -306,12 +307,14 @@ def test_dtype_mix(self): result = dpnp.where(ic, ia, ib) assert_array_equal(result, expected) - def test_error(self): - c = dpnp.array([True, True]) - a = dpnp.ones((4, 5)) - b = dpnp.ones((5, 5)) - assert_raises(ValueError, dpnp.where, c, a, a) - assert_raises(ValueError, dpnp.where, c[0], a, b) + @pytest.mark.parametrize("xp", [dpnp, numpy]) + def test_error(self, xp): + c = xp.array([True, True]) + a = xp.ones((4, 5)) + b = xp.ones((5, 5)) + + assert_raises(ValueError, xp.where, c, a, a) + assert_raises(ValueError, xp.where, c[0], a, b) def test_empty_result(self): a = numpy.zeros((1, 1)) @@ -321,6 +324,15 @@ def test_empty_result(self): result = dpnp.vstack(dpnp.where(ia == 99.0)) assert_array_equal(result, expected) + @testing.with_requires("numpy>=2.5") + @pytest.mark.parametrize("xp", [dpnp, numpy]) + def test_scalar_overflow(self, xp): + a = xp.array([1], dtype=xp.uint8) + b = 1000 + c = xp.array([True]) + assert_raises(OverflowError, xp.where, c, a, b) + assert_raises(OverflowError, xp.where, c, b, a) + @pytest.mark.parametrize("x_dt", get_all_dtypes(no_none=True)) @pytest.mark.parametrize("y_dt", get_all_dtypes(no_none=True)) def test_out(self, x_dt, y_dt):