Skip to content

test: cover Generator dump/load + async empty-response guard (Tier C)#332

Open
voorhs wants to merge 1 commit into
devfrom
cov/tier-c-generator
Open

test: cover Generator dump/load + async empty-response guard (Tier C)#332
voorhs wants to merge 1 commit into
devfrom
cov/tier-c-generator

Conversation

@voorhs

@voorhs voorhs commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

What

Coverage series (follow-up to #325), Tier C — generator/LLM glue.

The existing tests/generation/structured_output/ suite already covers the retry loop and RetriesExceededError. 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_async raising RuntimeError when the API returns an empty choices list.

The OpenAI client is constructed for real (no network) via the existing respx_openai fixture, which supplies a fake API key + model name.

Scope note

The remaining uncovered generator lines are the error is None defensive branches, which are effectively unreachable (when res 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

  • Verified locally with ruff check, ruff format --check, mypy --strict (Python 3.10). Execution left to CI (unit-tests job).

🤖 Generated with Claude Code

…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>
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