Files
ai-agent-book/chapter5/coding-agent/tests/test_exit_plan_mode_tool.py
T
liqiang b119135836
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
ai-agent-book 精选快照(<2MB 代码与文档,来自 github.com/bojieli/ai-agent-book)
2026-08-20 13:12:50 +00:00

69 lines
1.5 KiB
Python

"""
Test cases for ExitPlanMode tool
Tests all features from tools.json
"""
import pytest
from tools.exit_plan_mode_tool import ExitPlanModeTool
class TestExitPlanModeTool:
"""Test ExitPlanMode tool functionality"""
def test_basic_plan_submission(self, system_state):
"""Test submitting a plan"""
tool = ExitPlanModeTool(system_state)
plan = """
## Implementation Plan
1. Create database schema
2. Implement API endpoints
3. Write tests
"""
result = tool.execute({
"plan": plan
})
assert result.success
assert result.data["action"] == "exit_plan_mode"
assert result.data["plan"] == plan
assert "message" in result.data
def test_markdown_plan(self, system_state):
"""Test that plan supports markdown"""
tool = ExitPlanModeTool(system_state)
plan = """
# Implementation Plan
## Phase 1
- [ ] Task 1
- [ ] Task 2
## Phase 2
- [ ] Task 3
**Note**: This is a markdown plan
"""
result = tool.execute({
"plan": plan
})
assert result.success
assert "# Implementation Plan" in result.data["plan"]
assert "**Note**" in result.data["plan"]
def test_empty_plan(self, system_state):
"""Test with empty plan"""
tool = ExitPlanModeTool(system_state)
result = tool.execute({
"plan": ""
})
assert result.success
assert result.data["plan"] == ""