MCPcopy Create free account
hub / github.com/MiniMax-AI/Mini-Agent / test_read_tool

Function test_read_tool

tests/test_tools.py:13–32  ·  view source on GitHub ↗

Test read file tool.

()

Source from the content-addressed store, hash-verified

11
12@pytest.mark.asyncio
13async def test_read_tool():
14 """Test read file tool."""
15 print("\n=== Testing ReadTool ===")
16
17 # Create a temp file
18 with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".txt") as f:
19 f.write("Hello, World!")
20 temp_path = f.name
21
22 try:
23 tool = ReadTool()
24 result = await tool.execute(path=temp_path)
25
26 assert result.success, f"Read failed: {result.error}"
27 # ReadTool now returns content with line numbers in format: "LINE_NUMBER|LINE_CONTENT"
28 assert "Hello, World!" in result.content, f"Content mismatch: {result.content}"
29 assert "|Hello, World!" in result.content, f"Expected line number format: {result.content}"
30 print("✅ ReadTool test passed")
31 finally:
32 Path(temp_path).unlink()
33
34
35@pytest.mark.asyncio

Callers 1

mainFunction · 0.85

Calls 2

executeMethod · 0.95
ReadToolClass · 0.90

Tested by

no test coverage detected