feat: improve SQL component UX and Tool mode function names (#7988)
* update component * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Eric Hare <ericrhare@gmail.com>
This commit is contained in:
parent
4a195f73c5
commit
777200fab3
2 changed files with 7 additions and 27 deletions
|
|
@ -3,7 +3,7 @@ from pathlib import Path
|
|||
|
||||
import pytest
|
||||
from langflow.components.data.sql_executor import SQLComponent
|
||||
from langflow.schema import Data, DataFrame, Message
|
||||
from langflow.schema import DataFrame, Message
|
||||
|
||||
from tests.base import ComponentTestBaseWithoutClient
|
||||
|
||||
|
|
@ -89,11 +89,11 @@ class TestSQLComponent(ComponentTestBaseWithoutClient):
|
|||
assert "Error:" in result.text
|
||||
assert "Query: SELECT * FROM non_existent_table" in result.text
|
||||
|
||||
def test_build_dataframe(self, component_class: type[SQLComponent], default_kwargs):
|
||||
def test_sql_query_results(self, component_class: type[SQLComponent], default_kwargs):
|
||||
"""Test building a DataFrame from a SQL query."""
|
||||
component = component_class(**default_kwargs)
|
||||
|
||||
result = component.build_dataframe()
|
||||
result = component.sql_query_results()
|
||||
|
||||
assert isinstance(result, DataFrame)
|
||||
assert len(result) == 1
|
||||
|
|
@ -101,15 +101,3 @@ class TestSQLComponent(ComponentTestBaseWithoutClient):
|
|||
assert "name" in result.columns
|
||||
assert result.iloc[0]["id"] == 1
|
||||
assert result.iloc[0]["name"] == "name_test"
|
||||
|
||||
def test_build_data(self, component_class: type[SQLComponent], default_kwargs):
|
||||
"""Test building a Data object from a SQL query."""
|
||||
component = component_class(**default_kwargs)
|
||||
|
||||
result = component.build_data()
|
||||
|
||||
assert isinstance(result, Data)
|
||||
assert "result" in result.data
|
||||
assert len(result.data["result"]) == 1
|
||||
assert result.data["result"][0]["id"] == 1
|
||||
assert result.data["result"][0]["name"] == "name_test"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue