Skip to content

Commit bbd56c7

Browse files
added test for repr and test for default argument to constructor
1 parent cf9caeb commit bbd56c7

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
@@ -82,12 +82,19 @@ def check_print_info(platform):
8282
pytest.fail("Encountered an exception inside print_info().")
8383

8484

85+
def check_repr(platform):
86+
r = repr(platform)
87+
assert type(r) is str
88+
assert r != ""
89+
90+
8591
list_of_checks = [
8692
check_name,
8793
check_vendor,
8894
check_version,
8995
check_backend,
9096
check_print_info,
97+
check_repr,
9198
]
9299

93100

@@ -118,6 +125,15 @@ def test_platform_creation(valid_filter, check):
118125
check(platform)
119126

120127

128+
def test_default_platform_creation(check):
129+
platform = None
130+
try:
131+
platform = dpctl.SyclPlatform()
132+
except ValueError:
133+
pytest.skip("Failed to create default platform")
134+
check(platform)
135+
136+
121137
def test_invalid_platform_creation(invalid_filter, check):
122138
"""Tests if we can create a SyclPlatform using a supported filter selector
123139
string.

0 commit comments

Comments
 (0)