diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d02abbe14..b469721037 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,11 @@ Changes are grouped as follows - `Fixed` for any bug fixes. - `Security` in case of vulnerabilities. +## [7.49.1] - 2024-06-11 + +### Fixed +- Fixes resetting dataSetId to None in a ThreeDModelUpdate. + ## [7.49.0] - 2024-06-05 ### Added - `WorkfowExecutionAPI.list` now allows filtering by execution status. diff --git a/cognite/client/_version.py b/cognite/client/_version.py index 77306f4221..7f490d3c4a 100644 --- a/cognite/client/_version.py +++ b/cognite/client/_version.py @@ -1,4 +1,4 @@ from __future__ import annotations -__version__ = "7.49.0" +__version__ = "7.49.1" __api_subversion__ = "20230101" diff --git a/cognite/client/data_classes/three_d.py b/cognite/client/data_classes/three_d.py index 1db3904af0..1ee6f4c27f 100644 --- a/cognite/client/data_classes/three_d.py +++ b/cognite/client/data_classes/three_d.py @@ -204,8 +204,8 @@ def metadata(self) -> _ObjectThreeDModelUpdate: return ThreeDModelUpdate._ObjectThreeDModelUpdate(self, "metadata") @property - def data_set_id(self) -> _ObjectThreeDModelUpdate: - return ThreeDModelUpdate._ObjectThreeDModelUpdate(self, "dataSetId") + def data_set_id(self) -> _PrimitiveThreeDModelUpdate: + return ThreeDModelUpdate._PrimitiveThreeDModelUpdate(self, "dataSetId") @classmethod def _get_update_properties(cls) -> list[PropertySpec]: diff --git a/pyproject.toml b/pyproject.toml index 9d2d6dd4d8..be7fbcb05e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "cognite-sdk" -version = "7.49.0" +version = "7.49.1" description = "Cognite Python SDK" readme = "README.md" documentation = "https://cognite-sdk-python.readthedocs-hosted.com" diff --git a/tests/tests_unit/test_api/test_3d.py b/tests/tests_unit/test_api/test_3d.py index b368228542..73442536f6 100644 --- a/tests/tests_unit/test_api/test_3d.py +++ b/tests/tests_unit/test_api/test_3d.py @@ -58,6 +58,22 @@ def test_update_with_update_object(self, cognite_client, mock_3d_model_response) ][0] assert mock_3d_model_response.calls[0].response.json()["items"][0] == res.dump(camel_case=True) + def test_update_dataset(self, cognite_client, mock_3d_model_response): + update = ThreeDModelUpdate(id=1).data_set_id.set(2) + res = cognite_client.three_d.models.update(update) + assert {"id": 1, "update": {"dataSetId": {"set": 2}}} == jsgz_load( + mock_3d_model_response.calls[0].request.body + )["items"][0] + assert mock_3d_model_response.calls[0].response.json()["items"][0] == res.dump(camel_case=True) + + def test_reset_dataset(self, cognite_client, mock_3d_model_response): + update = ThreeDModelUpdate(id=1).data_set_id.set(None) + res = cognite_client.three_d.models.update(update) + assert {"id": 1, "update": {"dataSetId": {"setNull": True}}} == jsgz_load( + mock_3d_model_response.calls[0].request.body + )["items"][0] + assert mock_3d_model_response.calls[0].response.json()["items"][0] == res.dump(camel_case=True) + def test_update_with_resource_object(self, cognite_client, mock_3d_model_response): res = cognite_client.three_d.models.update(ThreeDModel(id=1, name="bla", created_time=123)) assert {"id": 1, "update": {"name": {"set": "bla"}}} == jsgz_load(mock_3d_model_response.calls[0].request.body)[