SIGN IN SIGN UP

chore(api): move chat validation tests out of generated code (#3698)

- [x] I understand that this repository is auto-generated and my pull
request may not be merged

## Changes being requested

Move the handwritten `chat.completions.create()` validation tests out of
the
generated resource-test file. The test methods and their client
parameterization
are copied verbatim; the generated file returns to the verified Castiron
output.

Coverage now lives in these exact tests:

-
[`tests/lib/chat/test_create_validation.py::TestCompletions::test_method_create_disallows_pydantic`](https://github.com/openai/openai-python/blob/f883c09550b4a123094b57659fb6a5b008b54581/tests/lib/chat/test_create_validation.py#L15)
  covers loose and strict synchronous clients.
-
[`tests/lib/chat/test_create_validation.py::TestAsyncCompletions::test_method_create_disallows_pydantic`](https://github.com/openai/openai-python/blob/f883c09550b4a123094b57659fb6a5b008b54581/tests/lib/chat/test_create_validation.py#L38)
  covers loose, strict, and aiohttp asynchronous clients.

All five cases still assert the existing `TypeError` and message when a
Pydantic `BaseModel` class is passed as `response_format` to `create()`.
No test
coverage, SDK implementation, public API, exception behavior, or client
mode is
removed.

## Additional context & links

Validation:

- The custom-code report verifies 42 -> 41 mixed files, one removed
  customization, and no changes to the other customizations.
- AST and source-text comparisons prove both methods and their
parameterization
  moved verbatim. Pytest collection confirms the same five cases.
- `./scripts/format` and `./scripts/lint` passed, including Ruff,
Pyright, mypy,
and import checks. Unrelated formatter-only changes to the existing
report
  scripts are not included.
- Command: `python -m pytest -q
tests/api_resources/chat/test_completions.py
tests/lib/chat/test_create_validation.py`
  passed 125 tests under Pydantic v2 and 125 under Pydantic v1.
- After rebasing onto the merged test cleanup in #3697, the exact-source
check
and full lint passed again. Command: `python -m pytest -q
tests/lib/chat/test_create_validation.py`
  passed all five cases again in both Pydantic modes.

No schema, configuration, compiler, dependency, fixture, or
generated-file
ownership changes are needed. The pure-generated content hash is
unchanged.
The existing `.castiron.stats.yml` is preserved byte-for-byte so this
test-only
PR does not overlap the separate release's generation metadata.

---------

Co-authored-by: apcha-oai <228803254+apcha-oai@users.noreply.github.com>
A
Alex Chang committed
9d3ba20f9567a62b2ebb3542661a60dc4ed2fd67
Parent: 351ef84
Committed by GitHub <noreply@github.com> on 8/20/2026, 8:07:58 PM