Skip to content

Commit 7383d06

Browse files
committed
test that platform and device aspect sets match
Catch SyclPlatform.has_aspect_* drifting from SyclDevice, or from the hard-coded test list.
1 parent 5da72de commit 7383d06

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎dpctl/tests/test_sycl_platform.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,17 @@ def test_platform_has_aspect_agrees_with_devices():
329329
), f"platform.{attr} disagrees with its devices"
330330

331331

332+
def test_platform_and_device_aspects_match():
333+
def aspects(cls):
334+
return {n for n in dir(cls) if n.startswith("has_aspect_")}
335+
336+
platform_aspects = aspects(dpctl.SyclPlatform)
337+
assert aspects(dpctl.SyclDevice) == platform_aspects
338+
assert {"has_aspect_" + a for a in list_of_platform_aspects} == (
339+
platform_aspects
340+
)
341+
342+
332343
def test_platform_get_composite_devices():
333344
platforms = dpctl.get_platforms()
334345
if platforms:

0 commit comments

Comments
 (0)