Skip to content

test: add unit tests for PatternDetector (closes #252)#255

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

test: add unit tests for PatternDetector (closes #252)#255
acailic wants to merge 1 commit into
mainfrom
issue-252/pattern-detector-tests

Conversation

@acailic

@acailic acailic commented Jun 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds tests/test_pattern_detector.py with 45 unit tests covering zero-coverage PatternDetector
  • Tests Pattern.to_dict() roundtrip and all expected keys
  • Tests _calculate_average_error_rate and _calculate_tool_failure_rate helpers including empty and zero-baseline edge cases
  • Tests all five detect_* methods: error rate trends, tool failure frequency, new failure modes, confidence drops, and detect_all_patterns (grouping by agent, critical-before-warning sort, baseline-too-small guard)

Closes #252

Test plan

  • python3 -m pytest -q tests/test_pattern_detector.py → 45 passed

🤖 Generated with Claude Code

45 tests covering Pattern.to_dict(), helper metrics, and all five
detect_* methods including severity thresholds, zero-baseline edge
cases, and detect_all_patterns grouping/sorting behaviour.

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