Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 12e2121

Browse files
committedApr 3, 2025·
Add tests for uncovered branches in advanced indexing
1 parent d426408 commit 12e2121

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
 

‎dpctl/tests/test_usm_ndarray_indexing.py

+15
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import dpctl
2323
import dpctl.tensor as dpt
2424
import dpctl.tensor._tensor_impl as ti
25+
from dpctl.tensor._copy_utils import _take_multi_index
2526
from dpctl.utils import ExecutionPlacementError
2627

2728
from .helper import get_queue_or_skip, skip_if_dtype_not_supported
@@ -1962,3 +1963,17 @@ def test_take_out_errors():
19621963
out_bad_q = dpt.empty(ind.shape, dtype=x.dtype, sycl_queue=q2)
19631964
with pytest.raises(dpctl.utils.ExecutionPlacementError):
19641965
dpt.take(x, ind, out=out_bad_q)
1966+
1967+
1968+
def test_getitem_impl_fn_invalid_inp():
1969+
get_queue_or_skip()
1970+
1971+
x = dpt.ones((10, 10), dtype="i4")
1972+
1973+
bad_ind_type = (dpt.ones((), dtype="i4"), 2.0)
1974+
with pytest.raises(TypeError):
1975+
_take_multi_index(x, bad_ind_type, 0, 0)
1976+
1977+
no_array_inds = (2, 3)
1978+
with pytest.raises(TypeError):
1979+
_take_multi_index(x, no_array_inds, 0, 0)

0 commit comments

Comments
 (0)
Please sign in to comment.