langflow/tests/unit/text_experimental_components.py
feiyang_deepnova 4d5a0df8d1
fix: the pythonfunction test error (#2572)
fix the test error
2024-07-08 15:48:33 +00:00

15 lines
431 B
Python

from langflow.components import prototypes
def test_python_function_component():
# Arrange
python_function_component = prototypes.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!"