Skip to content

test: port invariants asserted by the raven-toolbox suite - #683

Merged
edkerk merged 1 commit into
develop3from
test/port-python-invariants
Jul 17, 2026
Merged

test: port invariants asserted by the raven-toolbox suite#683
edkerk merged 1 commit into
develop3from
test/port-python-invariants

Conversation

@edkerk

@edkerk edkerk commented Jul 17, 2026

Copy link
Copy Markdown
Member

Main improvements in this PR:

Ports invariants the Python suite asserts on functions RAVEN also has, where the MATLAB tests assert only a type or a count. Test-only; no source changes.

  • documentation:
    • tManipulation.m: convertToIrrev bound-splitting and grRule inheritance; findDuplicateRxns ignoreDirection (its only parameter, previously untested); changeGrRules with replace=false; copyToComps with deleteOriginal; mergeModels metParam deciding metabolite unification.
    • tConditions.m: exchange reset, metabolite removal, the charge-balance recompute, and the biomass delta adding to rather than replacing a coefficient. This file previously had one test.

Instructions on merging this PR:

  • This PR has develop3 as target branch, and will be resolved with a squash-merge.

The Python suite asserts behaviour on functions RAVEN also has, where the
MATLAB tests only assert a type or a count. Ported the invariants that carry
over; skipped everything resting on cobra object semantics, pandas or an API
RAVEN does not have.

manipulation:
- convertToIrrev: a reversible reaction with bounds (-500,1000) keeps
  (0,1000) and its stoichiometry while the _REV copy gets (0,500) and the
  negated stoichiometry, and inherits the grRule. The existing test asserted
  only that every rev flag ended up 0, so the bound arithmetic — the only part
  that can be wrong — was untested.
- findDuplicateRxns: a -> b and b -> a group by default and stay separate with
  ignoreDirection=false. The function's only parameter had no test.
- changeGrRules: replace=false ORs onto the existing rule and adds the gene.
  Only replace=true was covered.
- copyToComps: deleteOriginal makes it a move rather than a copy.
- mergeModels: metParam decides whether the same metabolite under two ids
  unifies. The central design decision of the function had no test.

conditions: applyCondition had one test, for bounds. Added the prelude reset,
metabolite removal, the charge-balance recompute (the most numerically subtle
line in the file) and the biomass delta adding to rather than replacing a
coefficient.
@github-actions

Copy link
Copy Markdown

Function test results

250 tests   228 ✅  1m 0s ⏱️
 23 suites   22 💤
  1 files      0 ❌

Results for commit 80138aa.

@edkerk
edkerk merged commit fe6e222 into develop3 Jul 17, 2026
4 checks passed
@edkerk
edkerk deleted the test/port-python-invariants branch July 17, 2026 17:09
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