mirror of
https://github.com/langgenius/dify.git
synced 2026-05-07 02:46:32 +08:00
Co-authored-by: jyong <718720800@qq.com> Co-authored-by: Yansong Zhang <916125788@qq.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: hj24 <mambahj24@gmail.com> Co-authored-by: hj24 <huangjian@dify.ai> Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Co-authored-by: CodingOnStar <hanxujiang@dify.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
28 lines
722 B
Python
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
|