Skip to content

Commit a13a1fb

Browse files
Added tests to cover red lines in coverage report
Caught a bug and fixed it.
1 parent 59d4d65 commit a13a1fb

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

dpctl/tensor/_copy_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ def copy_from_usm_ndarray_to_usm_ndarray(dst, src):
250250
)
251251
else:
252252
src_same_shape = src
253+
src_same_shape.shape = common_shape
253254

254255
copy_same_shape(dst, src_same_shape)
255256

dpctl/tests/test_usm_ndarray_ctor.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,16 @@ def test_setitem_scalar(dtype, usm_type):
666666
)
667667

668668

669+
def test_setitem_errors():
670+
X = dpt.usm_ndarray((4,), dtype="u1")
671+
Y = dpt.usm_ndarray((4, 2), dtype="u1")
672+
with pytest.raises(ValueError):
673+
X[:] = Y
674+
with pytest.raises(ValueError):
675+
X[:] = Y[:, 0:1]
676+
X[:] = Y[None, :, 0]
677+
678+
669679
def test_shape_setter():
670680
def cc_strides(sh):
671681
return np.empty(sh, dtype="u1").strides

0 commit comments

Comments
 (0)