Skip to content

Commit dfcfe04

Browse files
added tests for dpctl.utils.validate_usm_type function
1 parent 80a1652 commit dfcfe04

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

dpctl/tests/test_utils.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,20 @@ def test_get_coerced_usm_type():
9494
assert dpctl.utils.get_coerced_usm_type([]) is None
9595
with pytest.raises(TypeError):
9696
dpctl.utils.get_coerced_usm_type(dict())
97+
98+
99+
def validate_usm_type_arg():
100+
_t = ["device", "shared", "host"]
101+
102+
for i in range(len(_t)):
103+
dpctl.utils.validate_usm_type(_t[i])
104+
dpctl.utils.validate_usm_type(_t[i], allow_none=False)
105+
dpctl.utils.validate_usm_type(None, allow_none=True)
106+
with pytest.raises(TypeError):
107+
dpctl.utils.validate_usm_type(dict(), allow_none=True)
108+
with pytest.raises(TypeError):
109+
dpctl.utils.validate_usm_type(dict(), allow_none=False)
110+
with pytest.raises(ValueError):
111+
dpctl.utils.validate_usm_type("inv", allow_none=True)
112+
with pytest.raises(ValueError):
113+
dpctl.utils.validate_usm_type("inv", allow_none=False)

0 commit comments

Comments
 (0)