Refactor test_custom_component.py
This commit is contained in:
parent
13783c1c60
commit
113861eb59
1 changed files with 6 additions and 9 deletions
|
|
@ -5,12 +5,9 @@ from uuid import uuid4
|
|||
import pytest
|
||||
from fastapi import HTTPException
|
||||
from langflow.interface.custom.base import CustomComponent
|
||||
from langflow.interface.custom.code_parser.code_parser import (CodeParser,
|
||||
CodeSyntaxError)
|
||||
from langflow.interface.custom.custom_component.component import (
|
||||
Component, ComponentCodeNullError)
|
||||
from langflow.interface.custom.utils import (build_custom_component_template,
|
||||
create_and_validate_component)
|
||||
from langflow.interface.custom.code_parser.code_parser import CodeParser, CodeSyntaxError
|
||||
from langflow.interface.custom.custom_component.component import Component, ComponentCodeNullError
|
||||
from langflow.interface.custom.utils import build_custom_component_template
|
||||
from langflow.services.database.models.flow import Flow, FlowCreate
|
||||
|
||||
code_default = """
|
||||
|
|
@ -535,12 +532,12 @@ def test_build_config_field_value_keys(component):
|
|||
|
||||
|
||||
def test_create_and_validate_component_valid_code(test_component_code):
|
||||
component = create_and_validate_component(test_component_code)
|
||||
component = CustomComponent(code=test_component_code)
|
||||
assert isinstance(component, CustomComponent)
|
||||
|
||||
|
||||
def test_build_langchain_template_custom_component_valid_code(test_component_code):
|
||||
component = create_and_validate_component(test_component_code)
|
||||
component = CustomComponent(code=test_component_code)
|
||||
frontend_node = build_custom_component_template(component)
|
||||
assert isinstance(frontend_node, dict)
|
||||
template = frontend_node["template"]
|
||||
|
|
@ -554,7 +551,7 @@ def test_build_langchain_template_custom_component_valid_code(test_component_cod
|
|||
|
||||
|
||||
def test_build_langchain_template_custom_component_templatefield(test_component_with_templatefield_code):
|
||||
component = create_and_validate_component(test_component_with_templatefield_code)
|
||||
component = CustomComponent(code=test_component_with_templatefield_code)
|
||||
frontend_node = build_custom_component_template(component)
|
||||
assert isinstance(frontend_node, dict)
|
||||
template = frontend_node["template"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue