优化性能
This commit is contained in:
@@ -96,7 +96,7 @@ async def test_project_detail_create_failure_preserves_push_id_and_biz_id() -> N
|
||||
assert result.metadata["key"] == "production"
|
||||
|
||||
|
||||
def test_project_detail_load_conflict_raises_on_same_project_key_different_data_id() -> None:
|
||||
def test_project_detail_load_allows_same_project_key_with_different_data_id() -> None:
|
||||
collection = DataCollection("remote")
|
||||
|
||||
project = _ProjectNode(
|
||||
@@ -119,16 +119,20 @@ def test_project_detail_load_conflict_raises_on_same_project_key_different_data_
|
||||
)
|
||||
collection._nodes[existing_detail.node_id] = existing_detail
|
||||
collection._data_id_to_node_id[existing_detail.data_id] = existing_detail.node_id
|
||||
collection._node_id_to_data_id[existing_detail.node_id] = existing_detail.data_id
|
||||
|
||||
handler = ProjectDetailApiHandler()
|
||||
handler.set_collection(collection)
|
||||
|
||||
with pytest.raises(RuntimeError, match="project_detail_data load conflict"):
|
||||
handler._create_node(
|
||||
{
|
||||
"id": "detail-new",
|
||||
"project_id": "project-1",
|
||||
"key": "actual_construction",
|
||||
"value": [{"date": "2026-01-02", "capacity": 2.0}],
|
||||
}
|
||||
)
|
||||
node = handler._create_node(
|
||||
{
|
||||
"id": "detail-new",
|
||||
"project_id": "project-1",
|
||||
"key": "actual_construction",
|
||||
"value": [{"date": "2026-01-02", "capacity": 2.0}],
|
||||
}
|
||||
)
|
||||
|
||||
assert node.node_id != existing_detail.node_id
|
||||
assert node.data_id == "detail-new"
|
||||
assert node.context["project_id"] == "project-1"
|
||||
|
||||
Reference in New Issue
Block a user