Skip to content

test: expand coverage — novelty, selection, utils (447→515 tests) - #18

Merged
cschanhniem merged 2 commits into
mainfrom
feat/pre-wetlab-final-improvements
Jun 27, 2026
Merged

cschanhniem merged 2 commits into
mainfrom
feat/pre-wetlab-final-improvements

Conversation

@cschanhniem

Copy link
Copy Markdown
Collaborator

Summary

  • Add 68 new unit tests covering four previously-untested modules
  • All lint-clean, all 515 pass

Changes

File Tests What's covered
test_selection_pareto.py 14 rank_candidates (ordering, immutability, ties), select_top (boundary cases)
test_selection_diversity.py 10 greedy_diverse_select (threshold behavior, near-dup exclusion, input-order priority)
test_utils.py 17 stable_json_hash (key order, diff values), file_sha256, write_jsonl, read_json/write_json
test_novelty.py 29 levenshtein (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 passed
  • ruff check — no issues
  • Pre-push hook passes (CI runs on push)

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
@cschanhniem
cschanhniem merged commit 7b3b391 into main Jun 27, 2026
1 of 2 checks passed
@cschanhniem
cschanhniem deleted the feat/pre-wetlab-final-improvements branch June 27, 2026 17:32
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