From eedd06ceb73e0fbbeee66f6bb38836443f8362c9 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Tue, 31 Jan 2023 10:26:39 -0600 Subject: [PATCH 1/3] Check that no unrecognized keywords are passed --- dpctl/_sycl_queue.pyx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dpctl/_sycl_queue.pyx b/dpctl/_sycl_queue.pyx index 6c6f3bf1d8..710b083020 100644 --- a/dpctl/_sycl_queue.pyx +++ b/dpctl/_sycl_queue.pyx @@ -290,6 +290,11 @@ cdef class SyclQueue(_SyclQueue): props = _parse_queue_properties( kwargs.pop('property', _queue_property_type._DEFAULT_PROPERTY) ) + if (kwargs): + raise TypeError( + f"Unsupported keyword arguments {kwargs} to " + "SyclQueue constructor encountered." + ) len_args = len(args) if len_args == 0: status = self._init_queue_default(props) From 993213792191532238e869cb77796aac2303ce23 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Mon, 30 Jan 2023 09:33:09 -0600 Subject: [PATCH 2/3] bump isort version to resolve 'poetry pip-shims extras dependency' --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0bc6856e68..392a0f7e75 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,7 +18,7 @@ repos: - id: black exclude: "versioneer.py|dpctl/_version.py" - repo: https://github.com/pycqa/isort - rev: 5.10.1 + rev: 5.12.0 hooks: - id: isort name: isort (python) From 8dd757b394f01c139b8386205f185f2e894c0684 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Tue, 31 Jan 2023 10:55:55 -0600 Subject: [PATCH 3/3] Added a test for validation of unrecognized keywords --- dpctl/tests/test_sycl_queue.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dpctl/tests/test_sycl_queue.py b/dpctl/tests/test_sycl_queue.py index 1f4a95fee3..a5038e4612 100644 --- a/dpctl/tests/test_sycl_queue.py +++ b/dpctl/tests/test_sycl_queue.py @@ -84,6 +84,14 @@ def test_invalid_filter_selectors(invalid_filter): dpctl.SyclQueue(invalid_filter) +def test_unexpected_keyword(): + """ + An unexpected keyword use raises TypeError. + """ + with pytest.raises(TypeError): + dpctl.SyclQueue(device="cpu") + + def test_context_not_equals(): try: gpuQ = dpctl.SyclQueue("gpu")