Skip to content

Bug fixes and testing for Stoichiometry#1052

Merged
sallymatson merged 14 commits intodevelopfrom
901-create-robust-testing-suite-for-stochiometry
Sep 29, 2025
Merged

Bug fixes and testing for Stoichiometry#1052
sallymatson merged 14 commits intodevelopfrom
901-create-robust-testing-suite-for-stochiometry

Conversation

@sallymatson
Copy link
Copy Markdown
Collaborator

@sallymatson sallymatson commented Sep 23, 2025

Description

  1. Various bug fixes and improvements for stoichiometry:
  • Fix the symbiote carbon supply calculations
  • Fix the deficit calculation (everything is CX ratio - so need to divide carbon by ratio to get the other element value)
  • Rename reclaim_ratio to turnover_ratio in FoliageTissue, to match the input which is passed through PFT extra traits as senesced leaf CN/CP ratios. This simplifies the foliage turnover, because now it's just the same calculation as others but using the turnover_ratio.
  • Add error handling for distribute_deficit and distrubte_surplus so they can only be called when the element_surplus is positive or negative respectively.
  • Simplify the calculations for distributing surplus and deficit for clarity and correctness.
  1. Testing suite for all Stoichiometry classes
  • These tests are now more validated for correctness, with clarity in the tests themselves for the logic and the calculations.

Fixes # (issue)

Type of change

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist

  • Make sure you've run the pre-commit checks: $ pre-commit run -a
  • All tests pass: $ poetry run pytest

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works
  • Relevant documentation reviewed and updated

@sallymatson sallymatson linked an issue Sep 23, 2025 that may be closed by this pull request
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Sep 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.25%. Comparing base (8ce7bdf) to head (7acfa08).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1052      +/-   ##
===========================================
- Coverage    95.26%   95.25%   -0.01%     
===========================================
  Files           81       81              
  Lines         6887     6895       +8     
===========================================
+ Hits          6561     6568       +7     
- Misses         326      327       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sallymatson sallymatson changed the title 901 create robust testing suite for stochiometry Bug fixes and testing for Stoichiometry Sep 24, 2025
Copy link
Copy Markdown
Collaborator

@davidorme davidorme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great - well structured and commented and very thorough.

I do have some big picture ideas on the test structure - just to make them a little more canonical / cleaner - which I think would be good to do. They're not blockers though.

@sallymatson sallymatson merged commit 975a39a into develop Sep 29, 2025
13 checks passed
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.

Create robust testing suite for Stochiometry

3 participants