Browse Source

test: fix code node

Signed-off-by: -LAN- <laipz8200@outlook.com>
tags/2.0.0-beta.1
-LAN- 1 month ago
parent
commit
9c2943183e
No account linked to committer's email address
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      api/core/workflow/nodes/code/code_node.py

+ 7
- 1
api/core/workflow/nodes/code/code_node.py View File

@@ -255,7 +255,13 @@ class CodeNode(Node):
)
elif output_config.type == SegmentType.NUMBER:
# check if number available
checked = self._check_number(value=result[output_name], variable=f"{prefix}{dot}{output_name}")
value = result.get(output_name)
if not isinstance(value, (int, float, None)):
raise OutputValidationError(
f"Output {prefix}{dot}{output_name} is not a number,"
f" got {type(result.get(output_name))} instead."
)
checked = self._check_number(value=value, variable=f"{prefix}{dot}{output_name}")
# If the output is a boolean and the output schema specifies a NUMBER type,
# convert the boolean value to an integer.
#

Loading…
Cancel
Save