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

Function test_edit_tool

tests/test_tools.py:53–72  ·  view source on GitHub ↗

Test edit file tool.

()

Source from the content-addressed store, hash-verified

51
52@pytest.mark.asyncio
53async def test_edit_tool():
54 """Test edit file tool."""
55 print("\n=== Testing EditTool ===")
56
57 with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".txt") as f:
58 f.write("Hello, World!")
59 temp_path = f.name
60
61 try:
62 tool = EditTool()
63 result = await tool.execute(
64 path=temp_path, old_str="World", new_str="Agent"
65 )
66
67 assert result.success, f"Edit failed: {result.error}"
68 content = Path(temp_path).read_text()
69 assert content == "Hello, Agent!", f"Content mismatch: {content}"
70 print("✅ EditTool test passed")
71 finally:
72 Path(temp_path).unlink()
73
74
75@pytest.mark.asyncio

Callers 1

mainFunction · 0.85

Calls 2

executeMethod · 0.95
EditToolClass · 0.90

Tested by

no test coverage detected