chore: ran linter and formatter
This commit is contained in:
@@ -52,7 +52,7 @@ class PromptBuilder:
|
||||
# Show first 5 results
|
||||
for i, result in enumerate(result_list[:5]):
|
||||
name = result.get("name", "Unknown")
|
||||
lines.append(f" {i+1}. {name}")
|
||||
lines.append(f" {i + 1}. {name}")
|
||||
if len(result_list) > 5:
|
||||
lines.append(f" ... and {len(result_list) - 5} more")
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ class TestPromptBuilderToolsInjection:
|
||||
|
||||
# Verify each tool is mentioned
|
||||
for tool_name in tools.keys():
|
||||
assert (
|
||||
tool_name in prompt
|
||||
), f"Tool {tool_name} not mentioned in system prompt"
|
||||
assert tool_name in prompt, (
|
||||
f"Tool {tool_name} not mentioned in system prompt"
|
||||
)
|
||||
|
||||
def test_tools_spec_contains_all_registered_tools(self, memory):
|
||||
"""CRITICAL: Verify build_tools_spec() returns all tools."""
|
||||
|
||||
@@ -22,9 +22,9 @@ class TestToolSpecFormat:
|
||||
|
||||
for spec in specs:
|
||||
# OpenAI format requires these fields
|
||||
assert (
|
||||
spec["type"] == "function"
|
||||
), f"Tool type must be 'function', got {spec.get('type')}"
|
||||
assert spec["type"] == "function", (
|
||||
f"Tool type must be 'function', got {spec.get('type')}"
|
||||
)
|
||||
assert "function" in spec, "Tool spec missing 'function' key"
|
||||
|
||||
func = spec["function"]
|
||||
@@ -55,9 +55,9 @@ class TestToolSpecFormat:
|
||||
# Verify required vs optional
|
||||
assert "name" in tool.parameters["required"], "name should be required"
|
||||
assert "age" in tool.parameters["required"], "age should be required"
|
||||
assert (
|
||||
"active" not in tool.parameters["required"]
|
||||
), "active has default, should not be required"
|
||||
assert "active" not in tool.parameters["required"], (
|
||||
"active has default, should not be required"
|
||||
)
|
||||
|
||||
def test_all_registered_tools_are_callable(self):
|
||||
"""CRITICAL: Verify all registered tools are actually callable."""
|
||||
@@ -127,9 +127,9 @@ class TestToolSpecFormat:
|
||||
properties = params.get("properties", {})
|
||||
|
||||
for param_name, param_spec in properties.items():
|
||||
assert (
|
||||
"description" in param_spec
|
||||
), f"Parameter {param_name} in {spec['function']['name']} missing description"
|
||||
assert "description" in param_spec, (
|
||||
f"Parameter {param_name} in {spec['function']['name']} missing description"
|
||||
)
|
||||
|
||||
def test_required_parameters_are_marked_correctly(self):
|
||||
"""Verify required parameters are correctly identified."""
|
||||
|
||||
@@ -181,9 +181,9 @@ class TestMakeToolsEdgeCases:
|
||||
params = tool.parameters
|
||||
if "required" in params and "properties" in params:
|
||||
for req in params["required"]:
|
||||
assert (
|
||||
req in params["properties"]
|
||||
), f"Required param {req} not in properties for {tool.name}"
|
||||
assert req in params["properties"], (
|
||||
f"Required param {req} not in properties for {tool.name}"
|
||||
)
|
||||
|
||||
def test_make_tools_descriptions_not_empty(self, memory):
|
||||
"""Should have non-empty descriptions."""
|
||||
@@ -234,9 +234,9 @@ class TestMakeToolsEdgeCases:
|
||||
if "properties" in tool.parameters:
|
||||
for prop_name, prop_schema in tool.parameters["properties"].items():
|
||||
if "type" in prop_schema:
|
||||
assert (
|
||||
prop_schema["type"] in valid_types
|
||||
), f"Invalid type for {tool.name}.{prop_name}"
|
||||
assert prop_schema["type"] in valid_types, (
|
||||
f"Invalid type for {tool.name}.{prop_name}"
|
||||
)
|
||||
|
||||
def test_make_tools_enum_values(self, memory):
|
||||
"""Should have valid enum values."""
|
||||
|
||||
@@ -226,13 +226,13 @@ class TestJsonTVShowRepository:
|
||||
[ShowStatus.ONGOING, ShowStatus.ENDED, ShowStatus.UNKNOWN]
|
||||
):
|
||||
show = TVShow(
|
||||
imdb_id=ImdbId(f"tt{i+1000000:07d}"),
|
||||
imdb_id=ImdbId(f"tt{i + 1000000:07d}"),
|
||||
title=f"Show {status.value}",
|
||||
seasons_count=1,
|
||||
status=status,
|
||||
)
|
||||
repo.save(show)
|
||||
loaded = repo.find_by_imdb_id(ImdbId(f"tt{i+1000000:07d}"))
|
||||
loaded = repo.find_by_imdb_id(ImdbId(f"tt{i + 1000000:07d}"))
|
||||
assert loaded.status == status
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user