Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

Accept to set a data node name using the property dict #807

Merged
merged 1 commit into from
Oct 26, 2023
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
2 changes: 1 addition & 1 deletion src/taipy/core/data/_data_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def _entity_to_model(cls, data_node: DataNode) -> _DataNodeModel:
data_node.config_id,
data_node._scope,
data_node.storage_type(),
data_node._name,
properties.pop("name", None) or data_node._name,
data_node.owner_id,
list(data_node._parent_ids),
data_node._last_edit_date.isoformat() if data_node._last_edit_date else None,
Expand Down
11 changes: 11 additions & 0 deletions tests/core/data/test_data_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -913,3 +913,14 @@ def test_explicit_label(self):
)
assert dn.get_label() == "a label"
assert dn.get_simple_label() == "a label"

def test_change_data_node_name(self):
cgf = Config.configure_data_node("foo", scope=Scope.GLOBAL)
dn = tp.create_global_data_node(cgf)

dn.name = "bar"
assert dn.name == "bar"

# This new syntax will be the only one allowed: https://github.com/Avaiga/taipy-core/issues/806
dn.properties["name"] = "baz"
assert dn.name == "baz"
Loading