Skip to content

test: regression suite for the predict.py rule/computed packs - #49

Merged
rvnminers-A-and-N merged 1 commit into
mainfrom
test/predict-pack-suite
Jun 27, 2026
Merged

rvnminers-A-and-N merged 1 commit into
mainfrom
test/predict-pack-suite

Conversation

@rvnminers-A-and-N

Copy link
Copy Markdown
Collaborator

Turns the 🟑 "built but unvalidated" packs in BUILD-STATUS.md into regression-guarded βœ…, and makes CI actually run Python tests (it previously only had ruff + a no-op pytest skip).

Coverage (19 tests, all model-independent so they run in CI)

  • Rules (test_rules.py) β€” sour/salty (incl. MSG deferring to the organic anion, NaCl firing), EU allergen labeling, dangerous-mixture screen (nitrite + secondary amine β†’ nitrosamine), empty-mixture well-formedness.
  • Computed packs (test_physchem.py) β€” physchem MW/logP/solubility, stability motif flags (vanillin's phenol + aldehyde), chemesthesis (astringent polyphenol, pungent isothiocyanate, silent on plain molecules).
  • predict() (test_predict.py) β€” stays well-formed and never crashes with no trained models (the CI case); rejects bad SMILES; predict_aroma() honest placeholder.
  • substitute() (test_substitute.py) β€” graceful with no reference set; correct Tanimoto ranking via a hand-built in-memory index.

Infra

  • requirements.txt β€” core runtime deps (rdkit, numpy, pandas, scikit-learn, joblib, pyarrow).
  • ci.yml β€” installs requirements.txt before pytest, so the suite runs without trained models or datasets.

Verified locally from the repo root with no models present (mirrors CI): 19 passed, ruff clean.

Covers the deterministic, model-independent logic so the 🟑 "built but
unvalidated" packs in BUILD-STATUS become regression-guarded β€” and CI actually
exercises them:

- test_rules: sour/salty calls (incl. MSG defers to the organic anion), allergen
  labeling, the documented dangerous-mixture screen (nitrite + amine -> nitrosamine).
- test_physchem: physchem MW/logP/solubility, stability motif flags (vanillin's
  phenol + aldehyde), chemesthesis (astringent polyphenol, pungent isothiocyanate).
- test_predict: predict() stays well-formed and never crashes with NO trained
  models (the CI case); bad-SMILES handling; predict_aroma honest placeholder.
- test_substitute: graceful with no reference set; correct Tanimoto ranking against
  a hand-built in-memory index (no data files needed).

Infra: requirements.txt (core runtime deps) and CI installs it before pytest, so
the suite runs in CI without trained models or datasets. 19 tests, all green.

Signed-off-by: Austin L. <86896075+rvnminers-A-and-N@users.noreply.github.com>
@rvnminers-A-and-N
rvnminers-A-and-N merged commit 9c900e5 into main Jun 27, 2026
2 checks passed
@rvnminers-A-and-N
rvnminers-A-and-N deleted the test/predict-pack-suite branch June 27, 2026 18:19
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