Skip to content

Commit 7962101

Browse files
authored
fix: iteration none output error (#10295)
1 parent ae254f0 commit 7962101

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

api/factories/variable_factory.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ def build_segment(value: Any, /) -> Segment:
9191
return ArrayObjectSegment(value=value)
9292
case SegmentType.FILE:
9393
return ArrayFileSegment(value=value)
94+
case SegmentType.NONE:
95+
return ArrayAnySegment(value=value)
9496
case _:
9597
raise ValueError(f"not supported value {value}")
9698
raise ValueError(f"not supported value {value}")

api/tests/unit_tests/core/app/segments/test_factory.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
StringVariable,
1414
)
1515
from core.variables.exc import VariableError
16+
from core.variables.segments import ArrayAnySegment
1617
from factories import variable_factory
1718

1819

@@ -156,3 +157,9 @@ def test_variable_cannot_large_than_200_kb():
156157
"value": "a" * 1024 * 201,
157158
}
158159
)
160+
161+
162+
def test_array_none_variable():
163+
var = variable_factory.build_segment([None, None, None, None])
164+
assert isinstance(var, ArrayAnySegment)
165+
assert var.value == [None, None, None, None]

0 commit comments

Comments
 (0)