Skip to content

Commit 68bc84e

Browse files
committed
make invert bool type check stricter
1 parent e28e1aa commit 68bc84e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

dpctl/tensor/_set_functions.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,8 +698,11 @@ def isin(
698698
du.validate_usm_type(res_usm_type, allow_none=False)
699699
sycl_dev = exec_q.sycl_device
700700

701-
if invert not in [True, False]:
702-
raise ValueError(f"`invert` must be `True` or `False`, got {invert}")
701+
if not isinstance(invert, bool):
702+
raise TypeError(
703+
"`invert` keyword argument must be of boolean type, "
704+
f"got {type(invert)}"
705+
)
703706

704707
x_dt = _get_dtype(x, sycl_dev)
705708
test_dt = _get_dtype(test_elements, sycl_dev)

dpctl/tests/test_tensor_isin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def test_isin_validation():
212212
with pytest.raises(ExecutionPlacementError):
213213
dpt.isin(1, 1)
214214
not_bool = dict()
215-
with pytest.raises(ValueError):
215+
with pytest.raises(TypeError):
216216
dpt.isin(dpt.ones([1]), dpt.ones([1]), invert=not_bool)
217217

218218

0 commit comments

Comments
 (0)