Skip to content

Add unit tests for response-terminal failure formatting#3545

Open
jluocsa wants to merge 1 commit into
openai:mainfrom
jluocsa:test/response-terminal-coverage
Open

Add unit tests for response-terminal failure formatting#3545
jluocsa wants to merge 1 commit into
openai:mainfrom
jluocsa:test/response-terminal-coverage

Conversation

@jluocsa
Copy link
Copy Markdown
Contributor

@jluocsa jluocsa commented May 31, 2026

Summary

src/agents/models/_response_terminal.py builds 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

  • New tests/models/test_response_terminal.py covering:
    • format_response_terminal_failure with no response, all details present, a mix of falsy/non-falsy details, and no details.
    • format_response_error_event with all details, partial details, and no details.
    • response_terminal_failure_error and response_error_event_failure_error wrapping the formatted message in a ModelBehaviorError.

Test plan

  • uv run pytest tests/models/test_response_terminal.py passes (9 tests).
  • _response_terminal.py coverage rises from 86% to 100%.
  • ruff format, ruff check, and mypy are clean on the new file.

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.

1 participant