Skip to content

Commit 63693e9

Browse files
Added missing tests for slicing
1 parent 0fe8333 commit 63693e9

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
@@ -234,3 +234,20 @@ def test_slice_suai(usm_type):
234234
assert np.array_equal(
235235
dpm.as_usm_memory(Xusm[ind]).copy_to_host(), Xh[ind]
236236
), "Failed for {}".format(ind)
237+
238+
239+
def test_slicing_basic():
240+
Xusm = dpt.usm_ndarray((10, 5), dtype="c16")
241+
Xusm[None]
242+
Xusm[...]
243+
Xusm[8]
244+
Xusm[-3]
245+
with pytest.raises(IndexError):
246+
Xusm[..., ...]
247+
with pytest.raises(IndexError):
248+
Xusm[1, 1, :, 1]
249+
Xusm[:, -4]
250+
with pytest.raises(IndexError):
251+
Xusm[:, -128]
252+
with pytest.raises(TypeError):
253+
Xusm[{1, 2, 3, 4, 5, 6, 7}]

0 commit comments

Comments
 (0)