Skip to content

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

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

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

Conversation

@acailic

@acailic acailic commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • Expands tests/patterns/test_pattern_detector.py from 21 → 39 tests
  • Adds TestPatternDataclassto_dict() key presence and value roundtrip
  • Adds TestHelperMethods — empty sessions, zero tool calls, rate calculations
  • Fills gaps in existing detection classes: severity escalation to critical, zero-baseline handling, no-pattern-below-threshold assertions, baseline < 3 guard, critical-before-warning sort order

Test plan

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

Closes #252

🤖 Generated with Claude Code

Expand tests/patterns/test_pattern_detector.py from 21 to 39 tests,
covering previously untested paths: Pattern.to_dict() roundtrip, helper
method edge cases (empty sessions, zero tool calls, rate calculations),
severity escalation to critical, zero-baseline error rate handling,
no-pattern-below-threshold cases for all detectors, baseline < 3 guard,
and critical-before-warning sort order in detect_all_patterns().

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