Add PythonFunctionComponent and test case for it

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-04-01 00:13:33 -03:00
commit a8779b1205
6 changed files with 56 additions and 44 deletions

View file

@ -0,0 +1,15 @@
from langflow.components import experimental
def test_python_function_component():
# Arrange
python_function_component = experimental.PythonFunctionComponent()
# Act
# function must be a string representation
function = "def function():\n return 'Hello, World!'"
# result is the callable function
result = python_function_component.build(function)
# Assert
assert result() == "Hello, World!"