MCPcopy Create free account
hub / github.com/bcefghj/miniClaudeCode / TestFileWriteTool

Class TestFileWriteTool

tests/test_tools.py:93–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91
92
93class TestFileWriteTool(unittest.TestCase):
94 def setUp(self):
95 self.tool = FileWriteTool()
96
97 def test_write_new_file(self):
98 with tempfile.TemporaryDirectory() as tmpdir:
99 path = Path(tmpdir) / "test.txt"
100 result = self.tool.execute({"path": str(path), "content": "hello world"})
101 self.assertFalse(result.is_error)
102 self.assertEqual(path.read_text(), "hello world")
103
104 def test_write_creates_directories(self):
105 with tempfile.TemporaryDirectory() as tmpdir:
106 path = Path(tmpdir) / "sub" / "dir" / "test.txt"
107 result = self.tool.execute({"path": str(path), "content": "nested"})
108 self.assertFalse(result.is_error)
109 self.assertTrue(path.exists())
110
111
112class TestFileEditTool(unittest.TestCase):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected