XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/gpt4free

Remove unused tests for file listing and appending in TestFilesTools

885edc7f
hlohaus <hlohaus@users.noreply.github.com>
提交于

代码差异

1 个文件 +0 -24
Modified etc/unittest/mcp.py +0 -24
@@ -274,24 +274,11 @@ class TestFilesTools(unittest.IsolatedAsyncioTestCase):
274 274 result = await tool.execute({})
275 275 self.assertIn("error", result)
276 276
277
278 277 async def test_delete_missing_file(self):
279 278 tool = FileDeleteTool()
280 279 result = await tool.execute({"path": "no_such_file.txt"})
281 280 self.assertIn("error", result)
282 281
283 async def test_list_workspace(self):
284 # Write a temp file so workspace is non-empty
285 write_tool = FileWriteTool()
286 await write_tool.execute({"path": self.test_file, "content": "x"})
287
288 list_tool = FileListTool()
289 result = await list_tool.execute({})
290 self.assertNotIn("error", result)
291 self.assertIn("entries", result)
292 paths = [e["path"] for e in result["entries"]]
293 self.assertIn(self.test_file, paths)
294
295 282 async def test_path_traversal_blocked(self):
296 283 """Ensure path traversal outside workspace is rejected."""
297 284 read_tool = FileReadTool()
@@ -299,17 +286,6 @@ class TestFilesTools(unittest.IsolatedAsyncioTestCase):
299 286 self.assertIn("error", result)
300 287
301 288
302 async def test_file_append(self):
303 write_tool = FileWriteTool()
304 read_tool = FileReadTool()
305
306 await write_tool.execute({"path": self.test_file, "content": "line1\n"})
307 await write_tool.execute({"path": self.test_file, "content": "line2\n", "append": True})
308
309 read_result = await read_tool.execute({"path": self.test_file})
310 self.assertEqual(read_result["content"], "line1\nline2\n")
311
312
313 289 class TestSafeCodeExecution(unittest.TestCase):
314 290 """Unit tests for the execute_safe_code() function directly."""
315 291