Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reset dataset for 3d model update #1804

Merged
merged 5 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion cognite/client/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import annotations

__version__ = "7.49.0"
__version__ = "7.49.1"
__api_subversion__ = "20230101"
4 changes: 2 additions & 2 deletions cognite/client/data_classes/three_d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
16 changes: 16 additions & 0 deletions tests/tests_unit/test_api/test_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)[
Expand Down
Loading