Skip to content

test: certificate content tests, simple_mutation tests, fix CWD path - #20

Merged
cschanhniem merged 2 commits into
mainfrom
feat/certificate-mutation-tests
Jun 28, 2026
Merged

cschanhniem merged 2 commits into
mainfrom
feat/certificate-mutation-tests

Conversation

@cschanhniem

Copy link
Copy Markdown
Collaborator

Summary

  • 22 new tests in tests/test_certificate.py covering all build_certificate fields — ID/sequence/source passthrough, scores, nearest_reference (None and set), references_checked, selection_reason, known_failure_modes, recommended_next_steps disclaimers, ISO timestamp format, pipeline version, config_hash stability and diff-sensitivity, required-keys set, schema validation
  • 20 new tests in tests/test_simple_mutation.py covering mutate_sequence edge cases: empty sequence, mutations=0 and negative, length preservation, canonical-AA-only output, Hamming ≤ 1 for single mutation, seed determinism, unseeded randomness
  • Bugfix in tests/test_certificate_schema.py: replaced CWD-dependent "schemas/candidate.schema.json" with anchored Path(__file__).parents[1] / "schemas" / "candidate.schema.json" so the test passes when invoked from any directory

Test plan

  • All 43 new/updated tests pass individually
  • Full suite: 662 passed (was 620)
  • Pre-push hook passes

…ependent schema path

- tests/test_certificate.py: 22 new tests for build_certificate content (all
  fields, hash stability, ISO timestamp, schema validation)
- tests/test_simple_mutation.py: 20 new tests for mutate_sequence (edge cases,
  determinism, canonical AA guarantee, length preservation)
- tests/test_certificate_schema.py: anchor schema path to repo root via
  Path(__file__).parents[1] so test passes regardless of CWD

662 tests total (was 620).
…bstitution test, update schema

- test_unseeded_calls_can_differ: add explanatory comment on entropy source + assertion message
- test_single_mutation_can_produce_identity_substitution: new test verifying
  choice(CANONICAL_AA) can land on the existing residue (Hamming=0 intentional)
- schemas/candidate.schema.json: add 'source' (string) and 'nearest_reference'
  (object | null) to properties; these were emitted by build_certificate but
  not declared in the schema
- tests/test_certificate.py: replace redundant schema-validation test with
  test_returns_dict; remove unused imports (validate_json_schema, Path)
@cschanhniem
cschanhniem merged commit a0dfd5a into main Jun 28, 2026
1 of 2 checks passed
@cschanhniem
cschanhniem deleted the feat/certificate-mutation-tests branch June 28, 2026 01:08
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