Skip to content

Commit 00cb985

Browse files
Added tests for #447
1 parent 7cee465 commit 00cb985

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

dpctl/tests/test_sycl_device_factory.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,17 @@ def test_get_devices_with_device_type_enum(device_type):
177177

178178

179179
def test_get_devices_with_device_type_str(device_type_str):
180-
devices = dpctl.get_devices(device_type=device_type_str)
181-
if len(devices):
182-
d = string_to_device_type(device_type_str)
183-
check_if_device_type_matches(devices, d)
180+
num_devices = dpctl.get_num_devices(device_type=device_type_str)
181+
if num_devices > 0:
182+
devices = dpctl.get_devices(device_type=device_type_str)
183+
assert len(devices) == num_devices
184+
dty = string_to_device_type(device_type_str)
185+
check_if_device_type_matches(devices, dty)
184186
check_if_device_type_is_valid(devices)
187+
# check for consistency of ordering between filter selector
188+
# where backend is omitted, but device type and id is specified
189+
for i in range(num_devices):
190+
dev = dpctl.SyclDevice(":".join((device_type_str, str(i))))
191+
assert dev == devices[i]
185192
else:
186193
pytest.skip()

0 commit comments

Comments
 (0)