Add unit tests for response-terminal failure formatting#3545
Open
jluocsa wants to merge 1 commit into
Open
Conversation
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
src/agents/models/_response_terminal.pybuilds the human-readable error messages used when a Responses stream ends on a terminal/error event. It was at 86% coverage: the detail-aggregation branches (status/error/incomplete_details and code/message/param) and the two error-wrapping helpers were not directly exercised. This adds focused unit tests that bring the module to 100% without touching any runtime code.Changes
tests/models/test_response_terminal.pycovering:format_response_terminal_failurewith no response, all details present, a mix of falsy/non-falsy details, and no details.format_response_error_eventwith all details, partial details, and no details.response_terminal_failure_errorandresponse_error_event_failure_errorwrapping the formatted message in aModelBehaviorError.Test plan
uv run pytest tests/models/test_response_terminal.pypasses (9 tests)._response_terminal.pycoverage rises from 86% to 100%.ruff format,ruff check, andmypyare clean on the new file.