Repository navigation
test: expand coverage — novelty, selection, utils (447→515 tests) - #18
Merged
Merged
Conversation
Add dedicated unit tests for previously-untested modules: - test_selection_pareto.py (14 tests): rank_candidates and select_top - test_selection_diversity.py (10 tests): greedy_diverse_select edge cases - test_utils.py (17 tests): stable_json_hash, file_sha256, write_jsonl, read/write_json - test_novelty.py: expanded from 2 → 29 tests covering levenshtein, normalized_similarity, and novelty_score including boundary conditions and directional assertions Total test count: 447 → 515 (+68 tests). All lint-clean.
- test_utils.py: fix JSONL unicode test to parse per-line not full file; replace NamedTemporaryFile(delete=False) with TemporaryDirectory to avoid temp file leaks; move hashlib import to module level - test_selection_diversity.py: strengthen test_returns_up_to_top_n assertion to == 2 (not <=); fix misleading comment on test_threshold_one_accepts_all (threshold=1.0 accepts ALL including exact dupes via <= 1.0 condition) - test_selection_pareto.py: add test_missing_ensemble_key_defaults_to_zero to document that missing ensemble silently ranks candidate last
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.
Summary
Changes
test_selection_pareto.pyrank_candidates(ordering, immutability, ties),select_top(boundary cases)test_selection_diversity.pygreedy_diverse_select(threshold behavior, near-dup exclusion, input-order priority)test_utils.pystable_json_hash(key order, diff values),file_sha256,write_jsonl,read_json/write_jsontest_novelty.pylevenshtein(edit ops, symmetry),normalized_similarity(boundary, range),novelty_score(nearest reference, edge cases)Motivation
Before wet-lab synthesis, every code path that affects scoring and selection needs coverage so regressions are caught immediately. The four modules above underpin the greedy diversity filter, the pipeline's final ranking, the reproducibility hashing in
run_manifest, and the novelty score that guards against selecting reference-set duplicates.Test plan
pytest -q— 515 passedruff check— no issues