Skip to content

test(cli): comprehensive test suite for is_complex_task, display_task_plan, and _make_agent (+80 tests) - #152

Open
manus-use wants to merge 1 commit into
mainfrom
feat/test-cli-dispatch-helpers
Open

test(cli): comprehensive test suite for is_complex_task, display_task_plan, and _make_agent (+80 tests)#152
manus-use wants to merge 1 commit into
mainfrom
feat/test-cli-dispatch-helpers

Conversation

@manus-use

Copy link
Copy Markdown
Owner

Summary

Comprehensive test suite for the three core CLI dispatch helper functions that have zero dedicated test coverage:

  • is_complex_task — the heuristic that decides single-agent vs multi-agent routing
  • display_task_plan — renders the multi-agent execution plan table via Rich
  • _make_agent — factory that instantiates the correct agent class (browser/data/mcp/manus)

What's tested (80 tests)

is_complex_task (55 tests)

  • Word count threshold (>30 words → complex)
  • Sentence count threshold (>2 sentences split by . or ;)
  • All 10 regex patterns: and...and, then, after, analyze...create/generate/build, compare...summarize, multiple, steps?, workflow, ordinals (first/second/third/finally), visualize/chart/graph...analyze/data, browse...extract/analyze, research...implement/create
  • Case insensitivity verification
  • Word boundary correctness (e.g. hereafterafter, sandboxand, steppingsteps)
  • Edge cases: empty string, whitespace, special characters, multiline input, URLs with dots

display_task_plan (8 tests)

  • Single task with no dependencies
  • Multiple tasks with chained dependencies
  • Long description truncation (>50 chars → ...)
  • Exactly 50-char descriptions preserved
  • Empty task list renders header
  • Comma-separated dependency display
  • All AgentType values (manus, browser, data_analysis, mcp)

_make_agent (17 tests)

  • Correct agent class instantiation for each type (browser → BrowserUseAgent, data → DataAnalysisAgent, mcp → MCPAgent, manus/default → ManusAgent)
  • Unknown/empty agent type falls back to ManusAgent
  • Keyword argument forwarding (callback_handler, multiple kwargs)
  • Exception propagation (ImportError, RuntimeError, TypeError)

Test quality

  • 100% mocked — no real HTTP calls or agent instantiation
  • All tests isolated and deterministic
  • Follows project conventions (pytest, unittest.mock)
  • Clean ruff check + ruff format

Test results

1238 passed, 3 deselected, 3 warnings in 24.46s

(Baseline 1158 + 80 new tests, 0 failures)

Checked against open PRs (no overlap)

No existing open or merged PR tests is_complex_task, display_task_plan, or _make_agent directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant