From 688b9568efa343873051ef5b116d85105dc8fc16 Mon Sep 17 00:00:00 2001 From: Ivan Polomani Date: Wed, 4 Dec 2024 12:58:38 +0100 Subject: [PATCH] fix(workflows): support None value for simulation input unit override (#2055) --- CHANGELOG.md | 3 +++ cognite/client/_version.py | 2 +- cognite/client/data_classes/simulators/runs.py | 2 +- pyproject.toml | 2 +- .../test_api/test_simulators/seed/resources.py | 7 +++++++ tests/tests_integration/test_api/test_workflows.py | 3 ++- 6 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b9d2ce5c..dbb07d6aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,9 @@ Changes are grouped as follows - `Fixed` for any bug fixes. - `Security` in case of vulnerabilities. +## [7.70.1] - 2024-12-04 +### Fixed +- Fix `workflows.executions.retrieve_detailed` type for `SimulationInputOverride` to allow for `None` value for `unit`. ## [7.70.0] - 2024-12-02 ### Added diff --git a/cognite/client/_version.py b/cognite/client/_version.py index f039101b9..afccad99c 100644 --- a/cognite/client/_version.py +++ b/cognite/client/_version.py @@ -1,5 +1,5 @@ from __future__ import annotations -__version__ = "7.70.0" +__version__ = "7.70.1" __api_subversion__ = "20230101" diff --git a/cognite/client/data_classes/simulators/runs.py b/cognite/client/data_classes/simulators/runs.py index 2d730dba3..291b0ab4b 100644 --- a/cognite/client/data_classes/simulators/runs.py +++ b/cognite/client/data_classes/simulators/runs.py @@ -44,7 +44,7 @@ def _load(cls, resource: dict[str, Any], cognite_client: CogniteClient | None = return cls( reference_id=resource["referenceId"], value=resource["value"], - unit=SimulationValueUnitName._load(resource["unit"], cognite_client) if "unit" in resource else None, + unit=SimulationValueUnitName._load(resource["unit"], cognite_client) if resource.get("unit") else None, ) def __post_init__(self) -> None: diff --git a/pyproject.toml b/pyproject.toml index dd6637c88..e875e444d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "cognite-sdk" -version = "7.70.0" +version = "7.70.1" description = "Cognite Python SDK" readme = "README.md" diff --git a/tests/tests_integration/test_api/test_simulators/seed/resources.py b/tests/tests_integration/test_api/test_simulators/seed/resources.py index 9f76a5311..d0282e787 100644 --- a/tests/tests_integration/test_api/test_simulators/seed/resources.py +++ b/tests/tests_integration/test_api/test_simulators/seed/resources.py @@ -97,6 +97,13 @@ def get_workflow_seed_data(data_set_id: int, file_id: int): "valueType": "DOUBLE", "unit": {"name": "C", "quantity": "temperature"}, }, + { + "name": "Hot Water Temperature", + "referenceId": "HWT", + "value": 1.0, + "valueType": "DOUBLE", + "unit": {"name": "C", "quantity": "temperature"}, + }, ], "outputs": [ { diff --git a/tests/tests_integration/test_api/test_workflows.py b/tests/tests_integration/test_api/test_workflows.py index ef95fb642..f4509b68e 100644 --- a/tests/tests_integration/test_api/test_workflows.py +++ b/tests/tests_integration/test_api/test_workflows.py @@ -381,7 +381,8 @@ def test_upsert_run_delete_with_simulation_task( inputs=[ SimulationInputOverride( reference_id="CWT", value=11, unit=SimulationValueUnitName(name="F") - ) + ), + SimulationInputOverride(reference_id="HWT", value=0.1), ], ), timeout=100,