From 6901cc6c4c554b817493576facb840d91adf59ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Blanco=20Culla?= <104149115+ziiiki@users.noreply.github.com> Date: Mon, 23 Sep 2024 18:13:12 +0200 Subject: [PATCH] Releases/0.22.x (#165) * 0.22.0 * now qprograms serialize to str instead of dict * fix unit tests * exclude qtesting from tests --- CHANGELOG.md | 4 +++- src/qiboconnection/__init__.py | 2 +- src/qiboconnection/typings/job_data.py | 4 ++-- tests/end2end/utils/utils.py | 2 +- tests/unit/test_job_listing_typings.py | 4 ++-- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 696333e..3335159 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ -## 0.22.0 +## 0.22.1 + +- Support new QProgram serialization. ## 0.21.0 diff --git a/src/qiboconnection/__init__.py b/src/qiboconnection/__init__.py index 9c70366..c0989b3 100644 --- a/src/qiboconnection/__init__.py +++ b/src/qiboconnection/__init__.py @@ -23,7 +23,7 @@ """ -__version__ = "0.22.0" +__version__ = "0.22.1" from .about import about diff --git a/src/qiboconnection/typings/job_data.py b/src/qiboconnection/typings/job_data.py index 6fe6e4a..034f518 100644 --- a/src/qiboconnection/typings/job_data.py +++ b/src/qiboconnection/typings/job_data.py @@ -36,8 +36,8 @@ def __init__(self, **kwargs): self.result = parse_job_response_to_result(job_response=JobResponse.from_kwargs(**kwargs)) # type: ignore self.description = deserialize_job_description(raw_description=self.description, job_type=self.job_type) - if not isinstance(self.result, (dict, list, type(None))): - raise ValueError("Job result needs to be a dict, a list or a None!") + if not isinstance(self.result, (dict, list, str, type(None))): + raise ValueError("Job result needs to be a dict, a list, a string or a None!") if not isinstance(self.description, (dict, type(None), Circuit, list, str)): raise ValueError("Job description needs to be a Qibo Circuit, a dict, a list, a str or a None!") diff --git a/tests/end2end/utils/utils.py b/tests/end2end/utils/utils.py index f3d462b..8635462 100644 --- a/tests/end2end/utils/utils.py +++ b/tests/end2end/utils/utils.py @@ -126,7 +126,7 @@ def get_devices_listing_params(user_role: UserRole = UserRole.ADMIN) -> list[Dev dev_devices = [ device for device in qibo_api.list_devices()._devices - if device.name not in ["qtesting_saruman", "qtesting_galadriel"] + if device.name not in ["qtesting_saruman", "qtesting_galadriel", "qili_qtesting"] ] return dev_devices except HTTPError: diff --git a/tests/unit/test_job_listing_typings.py b/tests/unit/test_job_listing_typings.py index 113210b..a463303 100644 --- a/tests/unit/test_job_listing_typings.py +++ b/tests/unit/test_job_listing_typings.py @@ -40,12 +40,12 @@ def test_JobData_typing_result_raises_value_error(): job_type="jaiof", number_shots=84, description=json.dumps(compress_any("Not string or list")), - result=json.dumps(compress_any("Not string or list")), + result=42, name="test", summary="test", ) - assert ex.match("Job result needs to be a dict, a list or a None!") + assert ex.match("Job result needs to be a dict, a list, a string or a None!") @patch("qiboconnection.typings.job_data.deserialize_job_description", autospec=True)