feat: add OS information to tool descriptions and implement unit tests (#5677)

* feat: add OS information to tool descriptions and implement unit tests

* refactor: use module-level constant for OS name as suggested in PR review
This commit is contained in:
miaoxutao123
2026-03-03 15:16:38 +08:00
committed by GitHub
parent fa4df0b5f3
commit 92ee534a2c
2 changed files with 25 additions and 2 deletions
+17
View File
@@ -0,0 +1,17 @@
import platform
from astrbot.core.computer.tools.python import PythonTool, LocalPythonTool
def test_python_tool_description_contains_os():
"""测试 PythonTool 的描述中是否包含当前操作系统信息"""
tool = PythonTool()
current_os = platform.system()
assert current_os in tool.description
assert "IPython" in tool.description
def test_local_python_tool_description_contains_os():
"""测试 LocalPythonTool 的描述中是否包含当前操作系统信息和兼容性提示"""
tool = LocalPythonTool()
current_os = platform.system()
assert current_os in tool.description
assert "Python environment" in tool.description
assert "system-compatible" in tool.description