Skip to content
Merged
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
24 changes: 18 additions & 6 deletions dpnp/tests/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
generate_random_numpy_array,
get_all_dtypes,
)
from .third_party.cupy import testing


@pytest.mark.parametrize("func", ["argmax", "argmin"])
Expand Down Expand Up @@ -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))
Expand All @@ -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):
Expand Down
Loading