Skip to content

Commit b40d357

Browse files
Added tests for equality testing and hashing of SyclPlatform
Also enabled overlooked check_default_context
1 parent 0bfc6f8 commit b40d357

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

dpctl/tests/test_sycl_platform.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,29 @@ def check_default_context(platform):
9292
assert type(r) is dpctl.SyclContext
9393

9494

95+
def check_equal_and_hash(platform):
96+
assert platform == platform
97+
default_ctx = platform.default_context
98+
for d in default_ctx.get_devices():
99+
assert platform == d.sycl_platform
100+
assert hash(platform) == hash(d.sycl_platform)
101+
102+
103+
def check_hash_in_dict(platform):
104+
map = {platform: 0}
105+
assert map[platform] == 0
106+
107+
95108
list_of_checks = [
96109
check_name,
97110
check_vendor,
98111
check_version,
99112
check_backend,
100113
check_print_info,
101114
check_repr,
115+
check_default_context,
116+
check_equal_and_hash,
117+
check_hash_in_dict,
102118
]
103119

104120

0 commit comments

Comments
 (0)