mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-22 19:51:02 +02:00
Update tests
This commit is contained in:
parent
6bccfd3d55
commit
d8dea2e8a8
1 changed files with 19 additions and 9 deletions
|
|
@ -406,9 +406,9 @@ class TestShowToolsStructuredQuery:
|
||||||
|
|
||||||
@patch('trustgraph.cli.show_tools.Api')
|
@patch('trustgraph.cli.show_tools.Api')
|
||||||
def test_show_mixed_tool_types(self, mock_api_class, mock_api, capsys):
|
def test_show_mixed_tool_types(self, mock_api_class, mock_api, capsys):
|
||||||
"""Test displaying multiple tool types including structured-query."""
|
"""Test displaying multiple tool types including structured-query and row-embeddings-query."""
|
||||||
mock_api_class.return_value, mock_config = mock_api
|
mock_api_class.return_value, mock_config = mock_api
|
||||||
|
|
||||||
tools = [
|
tools = [
|
||||||
{
|
{
|
||||||
"name": "ask_knowledge",
|
"name": "ask_knowledge",
|
||||||
|
|
@ -417,37 +417,47 @@ class TestShowToolsStructuredQuery:
|
||||||
"collection": "docs"
|
"collection": "docs"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "query_data",
|
"name": "query_data",
|
||||||
"description": "Query structured data",
|
"description": "Query structured data",
|
||||||
"type": "structured-query",
|
"type": "structured-query",
|
||||||
"collection": "sales"
|
"collection": "sales"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "find_customer",
|
||||||
|
"description": "Find customers by semantic search",
|
||||||
|
"type": "row-embeddings-query",
|
||||||
|
"schema-name": "customers",
|
||||||
|
"collection": "crm"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "complete_text",
|
"name": "complete_text",
|
||||||
"description": "Generate text",
|
"description": "Generate text",
|
||||||
"type": "text-completion"
|
"type": "text-completion"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
config_values = [
|
config_values = [
|
||||||
ConfigValue(type="tool", key=f"tool_{i}", value=json.dumps(tool))
|
ConfigValue(type="tool", key=f"tool_{i}", value=json.dumps(tool))
|
||||||
for i, tool in enumerate(tools)
|
for i, tool in enumerate(tools)
|
||||||
]
|
]
|
||||||
mock_config.get_values.return_value = config_values
|
mock_config.get_values.return_value = config_values
|
||||||
|
|
||||||
show_config("http://test.com")
|
show_config("http://test.com")
|
||||||
|
|
||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
output = captured.out
|
output = captured.out
|
||||||
|
|
||||||
# All tool types should be displayed
|
# All tool types should be displayed
|
||||||
assert "knowledge-query" in output
|
assert "knowledge-query" in output
|
||||||
assert "structured-query" in output
|
assert "structured-query" in output
|
||||||
|
assert "row-embeddings-query" in output
|
||||||
assert "text-completion" in output
|
assert "text-completion" in output
|
||||||
|
|
||||||
# Collections should be shown for appropriate tools
|
# Collections should be shown for appropriate tools
|
||||||
assert "docs" in output # knowledge-query collection
|
assert "docs" in output # knowledge-query collection
|
||||||
assert "sales" in output # structured-query collection
|
assert "sales" in output # structured-query collection
|
||||||
|
assert "crm" in output # row-embeddings-query collection
|
||||||
|
assert "customers" in output # row-embeddings-query schema-name
|
||||||
|
|
||||||
def test_show_main_parses_args_correctly(self):
|
def test_show_main_parses_args_correctly(self):
|
||||||
"""Test that show main() parses arguments correctly."""
|
"""Test that show main() parses arguments correctly."""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue