Skip to content

Commit a0dfd3e

Browse files
author
Yoshihiro Takahara
committed
Fix server tests and improve coverage
1 parent a89ab67 commit a0dfd3e

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

tests/test_server.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,29 @@ async def test_list_tools():
4040
(tool for tool in tools if tool.name == "edit_text_file_contents"), None
4141
)
4242
assert edit_contents_tool is not None
43-
assert "edit" in edit_contents_tool.description.lower()
43+
assert "file" in edit_contents_tool.description.lower()
4444
assert "contents" in edit_contents_tool.description.lower()
4545

4646

47+
@pytest.mark.asyncio
48+
async def test_get_contents_empty_files():
49+
"""Test get_contents handler with empty files list."""
50+
arguments = {"files": []}
51+
result = await get_contents_handler.run_tool(arguments)
52+
assert len(result) == 1
53+
assert result[0].type == "text"
54+
# Should return empty JSON object
55+
assert json.loads(result[0].text) == {}
56+
57+
58+
@pytest.mark.asyncio
59+
async def test_unknown_tool_handler():
60+
"""Test handling of unknown tool name."""
61+
with pytest.raises(ValueError) as excinfo:
62+
await call_tool("unknown_tool", {})
63+
assert "Unknown tool: unknown_tool" in str(excinfo.value)
64+
65+
4766
@pytest.mark.asyncio
4867
async def test_edit_contents_empty_patches():
4968
"""Test editing file contents with empty patches list."""

0 commit comments

Comments
 (0)