Skip to content

Commit e6bc9f2

Browse files
Improve coverage in _type_utils.py
1 parent 02293ef commit e6bc9f2

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

dpctl/tests/test_tensor_dtype_routines.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import pytest
1919

20+
import dpctl
2021
import dpctl.tensor as dpt
2122

2223
list_dtypes = [
@@ -127,3 +128,31 @@ def test_isdtype_kind_tuple_dtypes(dtype_str):
127128
def test_isdtype_invalid_kind(kind):
128129
with pytest.raises((TypeError, ValueError)):
129130
dpt.isdtype(dpt.int32, kind)
131+
132+
133+
def test_finfo_array():
134+
try:
135+
x = dpt.empty(tuple(), dtype="f4")
136+
except dpctl.SyclDeviceCreationError:
137+
pytest.skip("Default-selected SYCL device unavailable")
138+
o = dpt.finfo(x)
139+
assert o.dtype == dpt.float32
140+
141+
142+
def test_iinfo_array():
143+
try:
144+
x = dpt.empty(tuple(), dtype="i4")
145+
except dpctl.SyclDeviceCreationError:
146+
pytest.skip("Default-selected SYCL device unavailable")
147+
o = dpt.iinfo(x)
148+
assert o.dtype == dpt.int32
149+
150+
151+
def test_iinfo_validation():
152+
with pytest.raises(ValueError):
153+
dpt.iinfo("O")
154+
155+
156+
def test_finfo_validation():
157+
with pytest.raises(ValueError):
158+
dpt.iinfo("O")

0 commit comments

Comments
 (0)