agent-Specialization/test/test_tool_result_formatter.py
JOJO e3c897947f refactor(paths): 统一迁移运行态数据路径到 Astrion 命名空间
- 工作区内部路径 .agents/ -> .astrion/
- 默认运行态数据根 ~/.agents/agents/ -> ~/.astrion/astrion/
- 环境变量 AGENTS_DATA_ROOT -> ASTRION_DATA_ROOT(无兼容)
- 同步更新代码、测试、文档与脚本中的路径引用
- 新增 .gitignore 忽略 .astrion/ 与 .agents/ 运行态目录
2026-07-10 00:35:15 +08:00

30 lines
1002 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import unittest
from utils.tool_result_formatter import format_tool_result_for_context
class ToolResultFormatterTest(unittest.TestCase):
def test_read_skill_formats_full_read_content_like_read_file(self):
result = {
"success": True,
"type": "read",
"path": ".astrion/skills/frontend-design/SKILL.md",
"max_chars": 50000,
"truncated": False,
"content": "# Skill\nFull content",
"line_start": 1,
"line_end": 2,
"total_lines": 2,
"message": "已读取 .astrion/skills/frontend-design/SKILL.md 的内容(行 1~2",
}
formatted = format_tool_result_for_context("read_skill", result)
self.assertIn("读取 .astrion/skills/frontend-design/SKILL.md 行 1~2", formatted)
self.assertIn("```\n# Skill\nFull content\n```", formatted)
self.assertNotEqual(result["message"], formatted)
if __name__ == "__main__":
unittest.main()