langflow/tests/data/test_component.py
Gabriel Luiz Freitas Almeida 327cd0b462 Add test_component.py fixture
2023-12-04 17:23:32 -03:00

16 lines
498 B
Python

import random
from langflow import CustomComponent
class TestComponent(CustomComponent):
def refresh_values(self):
# This is a function that will be called every time the component is updated
# and should return a list of random strings
return [f"Random {random.randint(1, 100)}" for _ in range(5)]
def build_config(self):
return {"param": {"display_name": "Param", "options": self.refresh_values}}
def build(self, param: int):
return param