Skip to content

test: add unit tests for FrameTracer and DivergenceDetector#218

Open
acailic wants to merge 1 commit into
mainfrom
fix/208-frame-tracer-divergence-tests
Open

test: add unit tests for FrameTracer and DivergenceDetector#218
acailic wants to merge 1 commit into
mainfrom
fix/208-frame-tracer-divergence-tests

Conversation

@acailic

@acailic acailic commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #208

  • Add tests/test_frame_tracer_divergence.py with 51 unit tests covering FrameTracer and DivergenceDetector (both had zero coverage)
  • FrameTracer: TokenUsage arithmetic/serialization, FrameEvent dataclass and to_dict(), FrameLifetimeTrace construction, capture_function_call decorator (with/without context, exception capture, option flags), call tree building, cost breakdown, helper functions, round-trip serialization
  • DivergenceDetector: DivergenceType/DivergenceSeverity enum values, DivergencePoint dataclass and to_dict(), detect_divergences() (empty, identical, count mismatch, session ID extraction, summary, critical severity), compare_session_structures(), analyze_temporal_divergence(), analyze_behavioral_divergence()

Test plan

  • ruff check . — all checks passed
  • python3 -m pytest -q tests/test_frame_tracer_divergence.py — 51 passed in 0.51s

🤖 Generated with Claude Code

51 tests covering TokenUsage arithmetic, FrameEvent/FrameLifetimeTrace
serialization, build_frame_tree, FrameCaptureContext parent-child linking,
capture_function_call decorator (success/exception/options), helper
functions (get_frame_by_id, get_frames_at_depth, filter_frames_by_name,
get_cost_breakdown), serialization round-trip, DivergenceType/Severity
enums, DivergencePoint.to_dict, detect_divergences, compare_session_structures,
analyze_temporal_divergence, and analyze_behavioral_divergence.

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 FrameTracer and DivergenceDetector (zero coverage)

1 participant