fix: pythonfunction component execution (#3747)

* Added CodeInput to types

* Fixed PythonFunction to execute and return data or message

* [autofix.ci] apply automated fixes

* Added callable to outputs of pythonfunction

* [autofix.ci] apply automated fixes

* Updated function and tests

* Fixed lint issues

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Lucas Oliveira 2024-09-10 16:17:55 -03:00 • committed by GitHub
commit 0b1198efc4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 94 additions and 17 deletions

View file

@ -14,8 +14,13 @@ def test_python_function_component():
# Act
# function must be a string representation
function = "def function():\n return 'Hello, World!'"
python_function_component.function_code = function
# result is the callable function
result = python_function_component.build(function)
result = python_function_component.get_function_callable()
result_message = python_function_component.execute_function_message()
result_data = python_function_component.execute_function_data()
# Assert
assert result() == "Hello, World!"
assert result_message.text == "Hello, World!"
assert result_data[0].text == "Hello, World!"