Test write file tool.
()
| 34 | |
| 35 | @pytest.mark.asyncio |
| 36 | async def test_write_tool(): |
| 37 | """Test write file tool.""" |
| 38 | print("\n=== Testing WriteTool ===") |
| 39 | |
| 40 | with tempfile.TemporaryDirectory() as tmpdir: |
| 41 | file_path = Path(tmpdir) / "test.txt" |
| 42 | |
| 43 | tool = WriteTool() |
| 44 | result = await tool.execute(path=str(file_path), content="Test content") |
| 45 | |
| 46 | assert result.success, f"Write failed: {result.error}" |
| 47 | assert file_path.exists(), "File was not created" |
| 48 | assert file_path.read_text() == "Test content", "Content mismatch" |
| 49 | print("✅ WriteTool test passed") |
| 50 | |
| 51 | |
| 52 | @pytest.mark.asyncio |