Skip to content

test: safety_score + activity_likeness_score boundary coverage - #22

Merged
cschanhniem merged 2 commits into
mainfrom
feat/safety-activity-unit-tests
Jun 28, 2026
Merged

cschanhniem merged 2 commits into
mainfrom
feat/safety-activity-unit-tests

Conversation

@cschanhniem

Copy link
Copy Markdown
Collaborator

Summary

  • 32 tests in tests/test_scoring_safety.py — every risk condition in safety_score with explicit arithmetic, all 6 penalties (μH, hydrophobic fraction, charge density, length, cysteine, repeat run), boundary conditions (at-threshold vs. above), cumulative clamping, missing-key default
  • 29 tests in tests/test_scoring_activity.py — clamp01 + all 5 components of activity_likeness_score (length peak/floor, charge saturation, hydrophobic optimum, aromatic bonus cap, amphipathicity bonus cap + monotonicity), positive/negative known-sequence spot checks

These were the two core scoring functions driving the synthesis decision panel — safety_score had only 7 tests (no boundary arithmetic), activity_likeness_score had no dedicated unit tests at all.

Test plan

  • All 61 new tests pass
  • Full suite: 769 passed (was 708)
  • Pre-push hook passes

…isk/component boundaries

- tests/test_scoring_safety.py (32 tests): every risk condition boundary-tested
  with explicit arithmetic: μH threshold (0.55), hydrophobic fraction (0.65),
  charge density (0.55, uses abs), length (>35 flat +0.25), cysteine (>0.25
  flat +0.20), repeat run (>=6 flat +0.15); cumulative clamping, missing μH key

- tests/test_scoring_activity.py (29 tests): clamp01 + every scoring component
  of activity_likeness_score: length (peak at 18, zero at ±43), charge
  (clamped at cd>=0.50), hydrophobic (peak at 0.45), aromatic bonus (cap at
  0.20→0.10 max), amphipathicity bonus (cap at μH=0.8→0.15 max); monotonicity
  sweep; AMP positive/negative known-sequence spot checks

769 tests total (was 708).
… test

- test_scoring_activity.py: add test_length_30_midrange_verifies_normalization_constant
  (catches silent change to the /25 denominator) and
  test_hydrophobic_225_midrange_verifies_normalization_constant
  (catches silent change to the /0.45 denominator); these were flagged by
  code reviewer as the only tests that would fail if constants were changed

- test_scoring_safety.py: move test_no_hydrophobic_moment_feature_defaults_to_zero
  from TestCumulativePenalties to TestSafetyScoreBaseline (it tests a default
  parameter, not penalty accumulation)
@cschanhniem
cschanhniem merged commit 1cdacf1 into main Jun 28, 2026
@cschanhniem
cschanhniem deleted the feat/safety-activity-unit-tests branch June 28, 2026 01: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