Skip to content

test: fill test gaps for presynth-qc CLI, schema validation, SynthQC.to_dict, synthesis keys - #26

Merged
cschanhniem merged 2 commits into
mainfrom
feat/fill-test-gaps-presynth-schemas
Jun 28, 2026
Merged

cschanhniem merged 2 commits into
mainfrom
feat/fill-test-gaps-presynth-schemas

Conversation

@cschanhniem

Copy link
Copy Markdown
Collaborator

Summary

  • SynthQC.to_dict() (14 tests) — previously completely untested. This method serialises pre-synthesis QC results to CSV/JSON for lab ordering forms. Tests verify all 20 expected keys are present, types are correct (flags→list, oxidation_risk→bool, charge→float), and key values round-trip accurately.
  • validate_json_schema() error paths (4 tests) — only the happy path was tested. Added failure tests: ValidationError on invalid payload, missing required field, wrong type, and FileNotFoundError for a nonexistent schema path. A YAML typo in a schema path or a payload missing a required field now has explicit coverage.
  • presynth-qc CLI command (4 tests) — the command was entirely untested at the CLI layer despite being critical for synthesis ordering decisions. Tests cover: exit code 0, report file creation, Met-residue oxidation flag in output, and summary table with correct candidate count.
  • synthesis_feasibility_score() missing keys (3 tests) — documents that the function performs direct dict access (features["length"], features["longest_repeat_run"], features["cysteine_fraction"]). Callers must pass complete feature dicts from compute_features(). A partial dict now raises a clear KeyError rather than silently scoring incorrectly.

Test plan

  • pytest tests/test_presynth_qc.py tests/test_certificate_schema.py tests/test_cli.py tests/test_scoring_synthesis.py — 96 passed
  • Full suite: 808 passed (up from 782)
  • No regressions

…idation errors, synthesis missing keys

- test_presynth_qc.py: add SynthQC.to_dict() round-trip tests (14 cases covering all keys,
  types, boundary values); add check_panel missing-key error tests for 'candidate_id' and
  'sequence' columns — ensures the error message reaches the user before any pipeline crash
- test_certificate_schema.py: add 4 validate_json_schema failure tests — ValidationError on
  invalid payload, missing required field, wrong type, and FileNotFoundError on bad schema path;
  a YAML typo in the schema path or a payload that skips a required field now has explicit test
  coverage rather than silently passing
- test_cli.py: add 4 presynth-qc CLI integration tests — return code 0, report file creation,
  Met-residue flag appears in output, summary table has correct candidate count; the presynth-qc
  command is critical for ordering decisions and was previously untested at the CLI layer
- test_scoring_synthesis.py: add 3 KeyError tests for missing 'length', 'longest_repeat_run',
  and 'cysteine_fraction' keys — documents that callers (pipeline.py, cli.py) must provide all
  three keys via compute_features() rather than partial dicts
…ghten CLI Met test

- Replace vacuous charge_pH7.4 round-trip assertion (both sides were identical expressions)
  with a plausible-range check for KKKK (~3-5), plus separate tests that pin pI and
  mol_weight_da against the actual dataclass fields — catches field-mapping transpositions
- Add test_to_dict_pi_matches_isoelectric_point and test_to_dict_mol_weight_matches_molecular_weight_da
  so to_dict() key→field mapping is verified for all numeric molecular properties
- Tighten CLI presynth-qc Met flag assertion: require both "MET-001" and "MET" in the report
  rather than disjunction with the generic word "oxidation"
- Remove spurious blank line between stdlib and first-party imports in test_cli.py
@cschanhniem
cschanhniem merged commit 3512577 into main Jun 28, 2026
@cschanhniem
cschanhniem deleted the feat/fill-test-gaps-presynth-schemas branch June 28, 2026 02:33
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