Repository navigation
refactor: one number check, flahax.inputs.number - #319
Merged
Merged
Conversation
…l copies DeliveryError moves to inputs.py and is re-exported from delivery_contracts. conductivity, equilibrium_delivery and joint_problem use inputs.number.
…mber Each keeps its own error code through code=. Adds tests/test_inputs.py.
A numeric string is no longer coerced to a number; a missing value is missing_field. stock_evidence, ph_evidence and batch_stability raise DeliveryError (a ValueError) for a malformed number, caught as before.
…iveryError's new module
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #319 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 141 142 +1
Lines 17441 17406 -35
Branches 3555 3539 -16
=========================================
- Hits 17441 17406 -35
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #318.
One
flahax.inputs.number(value, name, *, minimum=0.0, positive=False, maximum=None, code=None, type_code='invalid_value')replaces nine private_numbercopies.DeliveryErrormoves toinputs.pyand is re-exported fromdelivery_contracts.invalid_ratio_input,invalid_stock_dosing,invalid_solubility_input) are kept throughcode=; no error code changes.delivery_contractsno longer coerces numeric strings and givesNonethe codemissing_field;stock_evidence,ph_evidenceandbatch_stabilityraiseDeliveryError(aValueError, caught whereValueErrorwas caught).batch_clidrops three re-checks of typed numbers (alkalinity, solid cap, reagent density). The other CLI guards parse text and stay.tests/test_inputs.py; regenerated the API reference becauseDeliveryError's module changed.Verification: every test module passes (record in
outputs/test-runs/2026-11-26-refactor-input-primitives/).test_file_headersfails the same 434 cases onmainon this Windows machine. The slowest ratio tests take about 205 to 255 s alone, the same onmain; they were run one by one. Not run locally: the full pre-push script (over the 5-minute limit); CI covers coverage and the build check. PHREEQC fixture not re-captured: no chemistry changed, only input validation.