Rebase onto upstream (a4d95fd) #12

Closed
wylab wants to merge 144 commits from rebase-onto-upstream into main
Showing only changes of commit 0afdaa5e7e - Show all commits
+21 -3
View File
@@ -1,7 +1,12 @@
"""Tests for Anthropic native tool base classes.""" """Tests for Anthropic native tool base classes."""
import pytest 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): class DummyTool(BaseAnthropicTool):
@@ -18,11 +23,24 @@ class DummyTool(BaseAnthropicTool):
def test_tool_result_dataclass(): def test_tool_result_dataclass():
"""Test ToolResult can be created with fields.""" """Test ToolResult can be created with all fields."""
result = ToolResult(output="hello", error=None) result = ToolResult(output="hello", error=None, base64_image=None, system="system message")
assert result.output == "hello" assert result.output == "hello"
assert result.error is None assert result.error is None
assert result.base64_image 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(): def test_base_anthropic_tool_to_params():