Skip to content

Commit 3f73105

Browse files
committed
Add a test for component and composite device methods
1 parent 066caf0 commit 3f73105

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Diff for: dpctl/tests/test_sycl_device.py

+26
Original file line numberDiff line numberDiff line change
@@ -312,3 +312,29 @@ def test_get_unpartitioned_parent_device_from_sub_device():
312312
pytest.skip("Default device can not be partitioned")
313313
assert isinstance(sdevs, list) and len(sdevs) > 0
314314
assert dev == sdevs[0].get_unpartitioned_parent_device()
315+
316+
317+
def test_composite_device_method():
318+
"""
319+
Test that the composite_device method returns a composite
320+
device found in ``dpctl.get_composite_devices()``
321+
"""
322+
devices = dpctl.get_devices()
323+
composite_devices = dpctl.get_composite_devices()
324+
for d in devices:
325+
if d.has_aspect_is_component:
326+
Cd = d.composite_device
327+
assert Cd in composite_devices
328+
329+
330+
def test_get_component_devices_from_composite():
331+
"""
332+
Test that the component_devices method returns component
333+
root devices.
334+
"""
335+
devices = dpctl.get_devices()
336+
composite_devices = dpctl.get_composite_devices()
337+
for Cd in composite_devices:
338+
component_devices = Cd.component_devices
339+
for d in component_devices:
340+
assert d in devices

0 commit comments

Comments
 (0)