优化性能

This commit is contained in:
strepsiades
2026-04-01 18:13:18 +08:00
parent 9a3a34c58b
commit f93a6c5c68
8 changed files with 198 additions and 107 deletions
@@ -263,7 +263,7 @@ async def test_create_all_marks_duplicate_project_key_in_same_batch_as_error() -
@pytest.mark.asyncio
async def test_create_node_raises_on_existing_project_key_with_different_data_id() -> None:
async def test_create_node_allows_existing_project_key_with_different_data_id() -> None:
collection = DataCollection("remote")
handler = ProjectDetailApiHandler()
@@ -278,15 +278,18 @@ async def test_create_node_raises_on_existing_project_key_with_different_data_id
)
await collection.add(existing)
with pytest.raises(RuntimeError, match="project_detail_data load conflict"):
handler._create_node(
{
"id": "remote-detail-99",
"project_id": "project-1",
"key": "plan_construction",
"value": [{"date": "2026-01-01", "capacity": 21.0}],
}
)
node = handler._create_node(
{
"id": "remote-detail-99",
"project_id": "project-1",
"key": "plan_construction",
"value": [{"date": "2026-01-01", "capacity": 21.0}],
}
)
assert node.node_id != existing.node_id
assert node.data_id == "remote-detail-99"
assert node.context["project_id"] == "project-1"
@pytest.mark.asyncio