Repository navigation
Add integration test suite: fixtures, criteria tests, evaluator tests… - #12
Merged
Merged
Conversation
…, CLI tests, and performance benchmark
Collaborator
Author
Maazkorejo
requested review from
Maazkorejo
and removed request for
Maazkorejo
September 5, 2026 19:26
Maazkorejo
approved these changes
Sep 6, 2026
MahrukhBaig
approved these changes
Sep 6, 2026
Khubaib8281
approved these changes
Sep 8, 2026
Khubaib8281
left a comment
Member
There was a problem hiding this comment.
Test coverage is good. lets get this merged
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.
Add integration test suite, fixtures, and performance benchmark
What does this PR do?
Adds the fixture dataset, pytest test suite, and performance benchmark for the
refusal_checkandfactual_groundingcriteria (Integration/Evaluation Engineer deliverables, DESIGN.md Section 5).Which module(s) does it touch?
tests/fixtures/criteria_fixtures.json— new. Hand-verified fixture cases (6 for refusal_check, 6 for factual_grounding) with known expected outcomes, per Section 5.6.tests/fixtures/verify_grounding.py— new. Standalone script to manually spot-check factual_grounding fixtures against the real embedding model, outside of pytest.tests/test_refusal_check.py— new. Parametrized pytest suite over the refusal_check fixtures, plus contract checks (score never None, required keys present).tests/test_factual_grounding.py— new. Parametrized pytest suite over the factual_grounding fixtures (score ranges + numeric-mismatch capping), plus a singleton-model regression test.tests/test_evaluator.py— new. Tests forEvaluator.evaluate()itself: default vs. requested criteria, fail-fast on unknown criterion names, overall_score averaging, and the score:None-excluded-not-zero rule (Section 3.3).tests/test_registry.py— new. Tests for the@register_criteriondecorator: registration, duplicate-name rejection,available_criteria(), direct callability.tests/test_cli.py— new. Tests forcli.pyusing Typer'sCliRunner: basic evaluation,--context, missing required--prompt, unknown-criterion error handling, default-to-all-criteria behavior.tests/test_performance.py— new. Benchmark per Section 5.4: fullevaluate()call under the 2-second target (two independent timing methods), plus a singleton-not-reloaded regression test at the Evaluator level.No existing source files (
evaluator.py,registry.py,cli.py, criteria files) were modified — this PR is tests/fixtures only.How did you test it?
Ran the full suite with coverage:
Result: 57 passed, 96% coverage on
llm_eval_kit/(target: 90%+ per Section 8.3).Also ran the performance benchmark on its own:
Result: 4 passed in 21.82s — full
evaluate()call comfortably under the 2-second target, and the embedding-model singleton confirmed not to reload across repeated calls.Coverage detail: how we got from 89% to 96%
The first full run (refusal_check + factual_grounding + evaluator + registry + numeric_parser tests, before
test_cli.pyexisted) gave:cli.pywas completely untested, which is what kept the overall number under the 90% target. Addingtests/test_cli.py(using Typer'sCliRunnerto exercise--prompt,--criteria, missing-argument handling, and error paths) broughtcli.pyfrom 0% to 95% and the overall project to 96%.Edge cases handled:
score: None, excluded fromoverall_scorerather than counted as 0ValueErrorbefore running any checker, even if other requested criteria are validscore: None→ correctly excluded fromoverall_score, verified not to silently count as 0--promptflag → fails cleanly before reaching EvaluatorKnown blockers (not in scope for this PR)
relevanceandcompletenesscriteria are not yet implemented by the Research Engineer — fixtures/tests for these will be added once available.pyproject.toml/setup.pyyet, sopip install .and thellm-evalconsole-script entry point can't be verified end-to-end (DESIGN.md Section 5.5). CLI was verified viapython -m llm_eval_kit.cliinstead.Checklist: