test: add unit tests for FrameTracer and DivergenceDetector#218
Open
acailic wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #208
tests/test_frame_tracer_divergence.pywith 51 unit tests coveringFrameTracerandDivergenceDetector(both had zero coverage)FrameTracer:TokenUsagearithmetic/serialization,FrameEventdataclass andto_dict(),FrameLifetimeTraceconstruction,capture_function_calldecorator (with/without context, exception capture, option flags), call tree building, cost breakdown, helper functions, round-trip serializationDivergenceDetector:DivergenceType/DivergenceSeverityenum values,DivergencePointdataclass andto_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 passedpython3 -m pytest -q tests/test_frame_tracer_divergence.py— 51 passed in 0.51s🤖 Generated with Claude Code