Skip to content

test: cover LLMJudge.score() - #2

Open
samarth70 wants to merge 1 commit into
daloopa:mainfrom
samarth70:test/cover-llmjudge-score
Open

test: cover LLMJudge.score()#2
samarth70 wants to merge 1 commit into
daloopa:mainfrom
samarth70:test/cover-llmjudge-score

Conversation

@samarth70

@samarth70 samarth70 commented Jul 12, 2026

Copy link
Copy Markdown

LLMJudge.score() was previously untested — tests/test_scoring.py only covers the ScoringInput/ScoringOutput Pydantic models, not the judge that produces a ScoringOutput. This PR adds offline unit tests for it.

Tests (tests/test_judge.py)

The OpenAI client is patched, so these run fully offline (no API key / no network). They pin the two things score() is responsible for:

  1. Output combination — the LLM's structured LLMJudgeOutput is merged with the input's index/configuration into a ScoringOutput (asserting index/configuration come from the input, not the model, and the LLM fields pass through unchanged).
  2. Request construction — the client is called with the configured model, temperature=0, and the LLMJudgeOutput response schema; the formatted prompt embeds the input fields and renders a missing unit as the N/A fallback (not a literal None).

Verification

pytest → 32 passed (3 new + existing, no regressions). ruff check and ruff format --check clean on the new file. No source changes.

The scoring logic was untested — test_scoring.py only covers the ScoringInput/
ScoringOutput Pydantic models, not the judge that produces them. Add offline
tests (OpenAI client patched, no API key/network) for LLMJudge.score():

- the LLM's structured output is combined with the input's index/configuration
  into a ScoringOutput (index/configuration come from the input, not the model);
- the client is called with the configured model, temperature=0, and the
  LLMJudgeOutput response schema;
- the prompt embeds the input fields and renders a missing unit as 'N/A'.
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