test: cover Generator dump/load + async empty-response guard (Tier C)#332
Open
voorhs wants to merge 1 commit into
Open
test: cover Generator dump/load + async empty-response guard (Tier C)#332voorhs wants to merge 1 commit into
voorhs wants to merge 1 commit into
Conversation
…uard Add tests for two previously-untested Generator paths: - the dump/load serialization round-trip (init params preserved across save). - get_chat_completion_async raising RuntimeError on an empty `choices` list. The OpenAI client is constructed for real (no network) via the respx fixture, which supplies a fake API key and model name. Runs in the unit-tests CI job (openai extra). Co-Authored-By: Claude Opus 4.8 <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.
What
Coverage series (follow-up to #325), Tier C — generator/LLM glue.
The existing
tests/generation/structured_output/suite already covers the retry loop andRetriesExceededError. This adds the two clean, deterministic gaps:Generator.dump/Generator.load— full serialization round-trip (model name, base URL,use_cache, and generation params preserved). Was untested.get_chat_completion_asyncraisingRuntimeErrorwhen the API returns an emptychoiceslist.The OpenAI client is constructed for real (no network) via the existing
respx_openaifixture, which supplies a fake API key + model name.Scope note
The remaining uncovered generator lines are the
error is Nonedefensive branches, which are effectively unreachable (whenres is None, the helper always sets an error message) — not worth forcing. Deeper generation modules (incremental_evolver,llm_encoder) are left for a future pass.Notes
ruff check,ruff format --check,mypy --strict(Python 3.10). Execution left to CI (unit-testsjob).🤖 Generated with Claude Code