Skip to content

test: add unit tests for PatternDetector (zero coverage)#254

Open
acailic wants to merge 1 commit into
mainfrom
issue-252-pattern-detector-tests
Open

test: add unit tests for PatternDetector (zero coverage)#254
acailic wants to merge 1 commit into
mainfrom
issue-252-pattern-detector-tests

Conversation

@acailic

@acailic acailic commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Closes #252

Summary

  • Adds tests/test_pattern_detector.py with 33 tests covering PatternDetector and Pattern
  • Pattern.to_dict — key completeness, isoformat datetime, optional fields default to None
  • _calculate_average_error_rate / _calculate_tool_failure_rate — empty, zero, and mixed inputs
  • detect_error_rate_trends — no-pattern, warning, critical, zero-baseline edge cases
  • detect_tool_failure_frequency — no-pattern, warning, critical severity escalation
  • detect_new_failure_modes — 2× and 3× thresholds, zero-error baseline
  • detect_confidence_drops — below threshold, warning, critical, improvement
  • detect_all_patterns — empty input, grouping by agent, critical-before-warning sort order, baseline minimum enforcement

Test plan

  • python3 -m pytest -q tests/test_pattern_detector.py → 33 passed
  • ruff check tests/test_pattern_detector.py → all checks passed

🤖 Generated with Claude Code

Adds tests/test_pattern_detector.py covering Pattern.to_dict,
helper methods, and all detection methods with severity escalation
and edge cases (empty inputs, zero baselines, threshold boundaries).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

test: add unit tests for PatternDetector (zero coverage)

1 participant