Rebase onto upstream (a4d95fd)
#12
@@ -1,7 +1,12 @@
|
||||
"""Tests for Anthropic native tool base classes."""
|
||||
|
||||
import pytest
|
||||
from nanobot.agent.tools.anthropic.base import BaseAnthropicTool, ToolResult
|
||||
from nanobot.agent.tools.anthropic.base import (
|
||||
BaseAnthropicTool,
|
||||
ToolResult,
|
||||
CLIResult,
|
||||
ToolError,
|
||||
)
|
||||
|
||||
|
||||
class DummyTool(BaseAnthropicTool):
|
||||
@@ -18,11 +23,24 @@ class DummyTool(BaseAnthropicTool):
|
||||
|
||||
|
||||
def test_tool_result_dataclass():
|
||||
"""Test ToolResult can be created with fields."""
|
||||
result = ToolResult(output="hello", error=None)
|
||||
"""Test ToolResult can be created with all fields."""
|
||||
result = ToolResult(output="hello", error=None, base64_image=None, system="system message")
|
||||
assert result.output == "hello"
|
||||
assert result.error is None
|
||||
assert result.base64_image is None
|
||||
assert result.system == "system message"
|
||||
|
||||
|
||||
def test_cli_result_dataclass():
|
||||
"""Test CLIResult can be created with output field."""
|
||||
result = CLIResult(output="command output")
|
||||
assert result.output == "command output"
|
||||
|
||||
|
||||
def test_tool_error_exception():
|
||||
"""Test ToolError can be raised and caught."""
|
||||
with pytest.raises(ToolError):
|
||||
raise ToolError("Test error message")
|
||||
|
||||
|
||||
def test_base_anthropic_tool_to_params():
|
||||
|
||||
Reference in New Issue
Block a user