Skip to content

Commit a21c97f

Browse files
Added test to check that assigned of different types of the same size work without errors
1 parent 5004aa1 commit a21c97f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

dpctl/tests/test_usm_ndarray_ctor.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,23 @@ def test_setitem_different_dtypes(src_dt, dst_dt):
708708
assert np.allclose(dpt.asnumpy(Z), np.tile(np.array([1, 0], Z.dtype), 10))
709709

710710

711+
def test_setitem_wingaps():
712+
try:
713+
q = dpctl.SyclQueue()
714+
except dpctl.SyclQueueCreationError:
715+
pytest.skip("Default queue could not be created")
716+
if np.dtype("intc").itemsize == np.dtype("int32").itemsize:
717+
dpt_dst = dpt.empty(4, dtype="int32", sycl_queue=q)
718+
np_src = np.arange(4, dtype="intc")
719+
dpt_dst[:] = np_src # should not raise exceptions
720+
assert np.array_equal(dpt.asnumpy(dpt_dst), np_src)
721+
if np.dtype("long").itemsize == np.dtype("longlong").itemsize:
722+
dpt_dst = dpt.empty(4, dtype="longlong", sycl_queue=q)
723+
np_src = np.arange(4, dtype="long")
724+
dpt_dst[:] = np_src # should not raise exceptions
725+
assert np.array_equal(dpt.asnumpy(dpt_dst), np_src)
726+
727+
711728
def test_shape_setter():
712729
def cc_strides(sh):
713730
return np.empty(sh, dtype="u1").strides

0 commit comments

Comments
 (0)