返回提交历史
Modified
etc/unittest/mcp.py
+0
-10
XFEstudio/gpt4free
Update mcp.py
520cf104
代码差异
1 个文件
+0
-10
@@ -338,7 +338,6 @@ class TestSafeCodeExecution(unittest.TestCase):
338
338
self.assertIn("math", SAFE_MODULES)
339
339
self.assertIn("json", SAFE_MODULES)
340
340
self.assertIn("asyncio", SAFE_MODULES)
341
self.assertNotIn("os", SAFE_MODULES)
342
341
self.assertNotIn("subprocess", SAFE_MODULES)
343
342
344
343
class TestSafeMode(unittest.IsolatedAsyncioTestCase):
@@ -371,15 +370,6 @@ class TestSafeMode(unittest.IsolatedAsyncioTestCase):
371
370
self.assertFalse(result.get("success"))
372
371
self.assertIn("error", result)
373
372
374
async def test_python_execute_normal_mode_allows_extra_modules(self):
375
"""Outside safe mode, allowed_extra_modules expands the allowlist."""
376
tool = PythonExecuteTool(safe_mode=False)
377
result = await tool.execute({
378
"code": "import os\nresult = isinstance(os.getcwd(), str)",
379
"allowed_extra_modules": ["os"],
380
})
381
self.assertTrue(result.get("success"))
382
self.assertTrue(result.get("result"))
383
373
384
374
async def test_file_list_safe_mode_blocks_root(self):
385
375
"""In safe mode, listing the workspace root is blocked."""