Conversation
Add tests for two uncovered code paths in render_detail.py: - _safe_event_data: ValidationError and ValueError recovery branches - _build_event_details: wildcard case returning '' for unhandled event types Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR closes #885 by adding unit tests that exercise previously uncovered exception-recovery paths in render_detail._safe_event_data() and the wildcard (case _:) branch in render_detail._build_event_details().
Changes:
- Add targeted tests to ensure
_safe_event_data()returnsNoneonValidationErrorandValueError. - Add a test ensuring
_build_event_details()returns""when_safe_event_data()returnsNone. - Add a test covering
_build_event_details()’s wildcard branch for unrecognized event types.
Contributor
There was a problem hiding this comment.
Low-impact test-only addition covering _safe_event_data exception recovery paths and _build_event_details wildcard case. Tests are meaningful, well-structured, follow existing patterns, and comply with coding guidelines. All CI checks pass. Auto-approving for merge.
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.
Closes #885
Adds tests for two uncovered code paths in
render_detail.py:Gap 1 —
_safe_event_dataexception recoveryNew
TestSafeEventDataclass with three tests:test_returns_none_on_validation_error— constructs aSessionEventwith invaliddata(attachments: 123instead oflist[str]) so Pydantic raisesValidationError; asserts the function catches it and returnsNone.test_returns_none_on_value_error— passes a parser that raisesValueError; asserts the function catches it and returnsNone.test_returns_none_propagates_to_build_event_details— confirms_build_event_detailsreturns""when_safe_event_datareturnsNonedue to invalid data.Gap 2 —
_build_event_detailswildcardcase _:test_build_event_details_returns_empty_for_unrecognized_type— passes aSESSION_RESUMEevent (not handled by any explicit case) and asserts the wildcard branch returns"".All existing checks pass (
make check: lint, typecheck, security, tests at 99% coverage).