From bbd56c71e8735823aceff3d1695c4f8ffd5a3ad3 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Wed, 1 Sep 2021 18:05:29 -0500 Subject: [PATCH] added test for repr and test for default argument to constructor --- dpctl/tests/test_sycl_platform.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dpctl/tests/test_sycl_platform.py b/dpctl/tests/test_sycl_platform.py index cf4b5bf59c..1333588d5e 100644 --- a/dpctl/tests/test_sycl_platform.py +++ b/dpctl/tests/test_sycl_platform.py @@ -82,12 +82,19 @@ def check_print_info(platform): pytest.fail("Encountered an exception inside print_info().") +def check_repr(platform): + r = repr(platform) + assert type(r) is str + assert r != "" + + list_of_checks = [ check_name, check_vendor, check_version, check_backend, check_print_info, + check_repr, ] @@ -118,6 +125,15 @@ def test_platform_creation(valid_filter, check): check(platform) +def test_default_platform_creation(check): + platform = None + try: + platform = dpctl.SyclPlatform() + except ValueError: + pytest.skip("Failed to create default platform") + check(platform) + + def test_invalid_platform_creation(invalid_filter, check): """Tests if we can create a SyclPlatform using a supported filter selector string.