Skip to content

Commit a53ca06

Browse files
test_full_gh_1230 to be have differently dependending on NumPy version
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.
1 parent abfee14 commit a53ca06

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

dpctl/tests/test_usm_ndarray_ctor.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1793,12 +1793,17 @@ def test_full_strides():
17931793

17941794
@pytest.mark.parametrize("dt", ["i1", "u1", "i2", "u2", "i4", "u4", "i8", "u8"])
17951795
def test_full_gh_1230(dt):
1796-
q = get_queue_or_skip()
1797-
dtype = "i4"
1796+
get_queue_or_skip()
1797+
dtype = dpt.dtype(dt)
17981798
dt_maxint = dpt.iinfo(dtype).max
17991799

1800-
with pytest.raises(OverflowError):
1801-
dpt.full(1, dt_maxint + 1, dtype=dtype, sycl_queue=q)
1800+
if (dtype.itemsize < 8) and (np.lib.NumpyVersion(np.__version__) < "2.0.0"):
1801+
X = dpt.full(1, fill_value=(dt_maxint + 1), dtype=dt)
1802+
Y = dpt.full_like(X, fill_value=dpt.iinfo(dt).min)
1803+
assert dpt.all(X == Y)
1804+
else:
1805+
with pytest.raises(OverflowError):
1806+
dpt.full(1, dt_maxint + 1, dtype=dt)
18021807

18031808

18041809
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)