(self)
| 65 | self.tool = FileReadTool() |
| 66 | |
| 67 | def test_read_existing_file(self): |
| 68 | with tempfile.NamedTemporaryFile(mode="w", suffix=".txt", delete=False) as f: |
| 69 | f.write("line1\nline2\nline3\n") |
| 70 | f.flush() |
| 71 | result = self.tool.execute({"path": f.name}) |
| 72 | self.assertFalse(result.is_error) |
| 73 | self.assertIn("line1", result.output) |
| 74 | self.assertIn("line2", result.output) |
| 75 | Path(f.name).unlink() |
| 76 | |
| 77 | def test_read_nonexistent(self): |
| 78 | result = self.tool.execute({"path": "/nonexistent/file.txt"}) |