dify/api/tests/unit_tests/models/test_conversation_variable.py
copilot-swe-agent[bot] fa74a4ed67
Merge deploy/dev into feat/evaluation - resolve merge conflicts
Agent-Logs-Url: https://github.com/langgenius/dify/sessions/489dd945-dfff-462a-9c76-d29fdaa55de2

Co-authored-by: FFXN <31929997+FFXN@users.noreply.github.com>
2026-04-17 08:29:13 +00:00

28 lines
722 B
Python

from uuid import uuid4
from graphon.variables import SegmentType
from factories import variable_factory
from models import ConversationVariable
def test_from_variable_and_to_variable():
variable = variable_factory.build_conversation_variable_from_mapping(
{
"id": str(uuid4()),
"name": "name",
"value_type": SegmentType.OBJECT,
"value": {
"key": {
"key": "value",
}
},
}
)
conversation_variable = ConversationVariable.from_variable(
app_id="app_id", conversation_id="conversation_id", variable=variable
)
assert conversation_variable.to_variable() == variable