Rebase onto upstream (a4d95fd)
#12
@@ -3,6 +3,7 @@
|
||||
import pytest
|
||||
from pathlib import Path
|
||||
from nanobot.agent.tools.anthropic.edit import EditTool20250728
|
||||
from nanobot.agent.tools.anthropic.base import CLIResult
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -89,3 +90,27 @@ async def test_insert_command(edit_tool, temp_file):
|
||||
content = temp_file.read_text()
|
||||
lines = content.splitlines()
|
||||
assert lines[1] == "inserted line"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_edit_tool_requires_absolute_path():
|
||||
"""Test edit tool rejects relative paths."""
|
||||
tool = EditTool20250728()
|
||||
|
||||
result = await tool(
|
||||
command="view",
|
||||
path="relative/path.txt"
|
||||
)
|
||||
|
||||
assert isinstance(result, CLIResult)
|
||||
assert result.exit_code == 1
|
||||
assert "absolute" in result.error.lower()
|
||||
|
||||
|
||||
def test_edit_tool_to_params():
|
||||
"""Test edit tool returns correct params."""
|
||||
tool = EditTool20250728()
|
||||
params = tool.to_params()
|
||||
|
||||
assert params["type"] == "text_editor_20250728"
|
||||
assert params["name"] == "str_replace_editor"
|
||||
|
||||
Reference in New Issue
Block a user