浏览代码

fix: iteration none output error (#10295)

tags/0.11.0
Novice 1年前
父节点
当前提交
7962101e5e
没有帐户链接到提交者的电子邮件
共有 2 个文件被更改,包括 9 次插入0 次删除
  1. 2
    0
      api/factories/variable_factory.py
  2. 7
    0
      api/tests/unit_tests/core/app/segments/test_factory.py

+ 2
- 0
api/factories/variable_factory.py 查看文件

@@ -91,6 +91,8 @@ def build_segment(value: Any, /) -> Segment:
return ArrayObjectSegment(value=value)
case SegmentType.FILE:
return ArrayFileSegment(value=value)
case SegmentType.NONE:
return ArrayAnySegment(value=value)
case _:
raise ValueError(f"not supported value {value}")
raise ValueError(f"not supported value {value}")

+ 7
- 0
api/tests/unit_tests/core/app/segments/test_factory.py 查看文件

@@ -13,6 +13,7 @@ from core.variables import (
StringVariable,
)
from core.variables.exc import VariableError
from core.variables.segments import ArrayAnySegment
from factories import variable_factory


@@ -156,3 +157,9 @@ def test_variable_cannot_large_than_200_kb():
"value": "a" * 1024 * 201,
}
)


def test_array_none_variable():
var = variable_factory.build_segment([None, None, None, None])
assert isinstance(var, ArrayAnySegment)
assert var.value == [None, None, None, None]

正在加载...
取消
保存