Repository navigation
test: fill test gaps for presynth-qc CLI, schema validation, SynthQC.to_dict, synthesis keys - #26
Merged
Merged
Conversation
…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
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
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-qcCLI 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 fromcompute_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