33 lines
1020 B
Python
33 lines
1020 B
Python
import json
|
|
import unittest
|
|
|
|
from tools.task_progress import TaskProgressTool
|
|
|
|
|
|
class TaskProgressToolTests(unittest.TestCase):
|
|
def test_schema_requires_complete_steps_snapshot(self) -> None:
|
|
schema = TaskProgressTool().schema
|
|
|
|
fn = schema["function"]
|
|
self.assertEqual(fn["name"], "task_progress")
|
|
params = fn["parameters"]
|
|
self.assertEqual(params["required"], ["steps"])
|
|
self.assertNotIn("action", params["properties"])
|
|
self.assertNotIn("step", params["properties"])
|
|
|
|
def test_execute_returns_short_ui_only_result(self) -> None:
|
|
out = TaskProgressTool().execute(
|
|
steps=[
|
|
{"id": "s1", "title": "理解需求", "status": "completed"},
|
|
{"id": "s2", "title": "实现功能", "status": "in_progress"},
|
|
],
|
|
)
|
|
|
|
data = json.loads(out)
|
|
self.assertEqual(data, {"ok": True, "step_count": 2})
|
|
self.assertLess(len(out), 80)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|