Skip to content

Commit

Permalink
fix: iteration none output error
Browse files Browse the repository at this point in the history
  • Loading branch information
Nov1c444 committed Nov 5, 2024
1 parent 5f21d13 commit 6eebafc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/factories/variable_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 7 additions & 0 deletions api/tests/unit_tests/core/app/segments/test_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
StringVariable,
)
from core.variables.exc import VariableError
from core.variables.segments import ArrayAnySegment
from factories import variable_factory


Expand Down Expand Up @@ -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]

0 comments on commit 6eebafc

Please sign in to comment.