Skip to content

Commit

Permalink
test_full_gh_1230 to be have differently dependending on NumPy version
Browse files Browse the repository at this point in the history
For 2.0.0 and later, it is to raise OverflowError, otherwise it is expected
to wrap up the out-of-bounds integral fill-in values given as Python scalars.
  • Loading branch information
oleksandr-pavlyk committed Aug 20, 2024
1 parent 83b704a commit f29e335
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions dpctl/tests/test_usm_ndarray_ctor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1797,8 +1797,13 @@ def test_full_gh_1230(dt):
dtype = "i4"
dt_maxint = dpt.iinfo(dtype).max

with pytest.raises(OverflowError):
dpt.full(1, dt_maxint + 1, dtype=dtype, sycl_queue=q)
if np.lib.NumpyVersion(np.__version__) < "2.0.0":
X = dpt.full(1, fill_value=(dt_maxint + 1), dtype=dtype, sycl_queue=q)
Y = dpt.full_like(X, fill_value=dpt.iinfo(dtype).min)
assert dpt.all(X == Y)
else:
with pytest.raises(OverflowError):
dpt.full(1, dt_maxint + 1, dtype=dtype, sycl_queue=q)


@pytest.mark.parametrize(
Expand Down

0 comments on commit f29e335

Please sign in to comment.