Repository navigation
Conversation
The four model files each pasted their own test_structure; one table-driven test in test_asm3_2step.py now checks every member's size, the states and processes it adds or inherits, those it replaces, and (new) its exact set of required conditions. Part of #726 (item 5). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The parser tests that checked only the root node's type now compare the whole tree with one built by hand, so precedence, associativity and argument order are pinned. The Takacs mass balance, allowed 15 % drift, now checks inflow - outflow = accumulation in the layers to round-off, at steady state and while the blanket moves; with the overflow read from the wrong layer the old test passed and the new ones fail. Part of #726 (item 2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
evaluate_bsm1 (its energy terms against the published BSM1 closed forms, on the warm-start state without a solve), the cached recycle map (on a two-species loop through stateless units, where M is 0.3 rather than the zero a loop through a tank gives), and reverse-mode AD through the layered biofilm solve (a three-layer film against a finite difference). Each was seen to fail with the code under it broken. Part of #726 (item 7). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An empty file read as a matrix or a table (the shared CSV reader's own check; the trajectory reader's was already tested) and a blank theta parameter name in a temperature correction. Part of #726 (item 3). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The coverage run of the fast tier left eight raise sites in aquakin unexecuted by any test. Four are reachable and now have tests that fail with the check disabled: - BatchReactor.solve(t_span=None) passed explicitly. - predictive_band when every draw fails to solve (the first solve error is kept as the cause) and when every draw overflows without raising. - A unit added after a unit already named after its model. - A required catalogue setting that can only be given from Python. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Generated by Claude Code |
This branch has not been deployed
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.
Part of #726 (items 2, 3, 5 and 7). Still open under #726: bromate validation against published data (item 6), which needs measured trajectories this PR does not have.
Summary
The remaining test-quality items of the audit, apart from item 6.
Item 2: tests that checked a type, or a loose tolerance
tests/unit/test_parser.py: the twelve tests that asserted only the root node's type now also compare the whole parsed tree, e.g.MultiplyNode(MultiplyNode(ParamNode("k1"), SpeciesNode("O3")), SpeciesNode("Br-")), which pins associativity and operand order.tests/integration/test_takacs.py:test_overall_mass_balanceusedrel=0.15. It now closes the heterotroph balance exactly, in − out = accumulation (the accumulation is each layer's volume times itsXB_Hrate) to1e-10of the inflow, and checks that out ≈ in to1e-8at steady state. The new testtest_mass_balance_closes_while_the_blanket_movesdoes the same while a flow step moves the sludge blanket.Item 3: error branches no test reaches
A coverage run of the fast tier, filtered to
raisestatements whose message no test mentions, left ten. Seven are reachable and are now tested:read_matrix/read_tableon an empty file, and a temperature correction with a blankthetaname (test_study_files.py,test_model_spec.py).BatchReactor.solve(t_span=None)passed explicitly.predictive_bandwhen every draw fails to solve (the test asserts that the first solve error is kept as__cause__), and when every draw finishes but overflows (C0 = 1e308).storagekind with that setting made required. No shipped kind has one yet.The other three can't be reached from the public API; see below.
Item 5: the shared
test_structurein the fourtest_asm3_2step*filesThey are now one parametrized
test_structureintest_asm3_2step.py, driven by a table of species, reactions, absent names and required conditions per model. Every assertion of the four copies is kept, and the exact set of required conditions is a new check.Item 7: code only
slowtests exercisedThree new fast tests:
test_bsm1.py):evaluate_bsm1's aeration, pumping and mixing energies and the OCI identity, computed by hand from the benchmark definitions on aPlantSolutionbuilt from the warm-start state. It also checks which tanks count as aerated.test_biofilm.py): three layers, checked against a central finite difference atrel=1e-5.test_recycle_cached_map.py): a mixer → 30 % splitter loop on the decay model. The test assertsM = [0.3, 0.3], a cached RHS bit-identical to the probed one, and the hand-computed RHS.Things a reviewer should know
Item 5 removes
test_structurefrom three files, sotest integrityreports three findings and waits for the owner'stest-weakening-approvedlabel. No assertion is lost: each moved into a row of the table intest_asm3_2step.py.Three raise sites are left untested because no public input reaches them:
core/compiler.py:500(undeclared species in a stoichiometry)plant/plant.py:1426(model parameter vs flow setpoint name)add_unitrefuses a unit named after a plant model, from both sides, and a unit's model is not reassigned afterwards.plant/plant.py:2699(stream not yet available)KeyError. The controller path passes every sensed source in.I left the code alone: whether to delete them is a separate decision.
The recycle test's loop goes through stateless units on purpose. A loop through a tank has
M = 0, so a wrongMgoes unseen there. The RHS comparison usesrtol=1e-10because the fixed-point solve leaves about 1e-12 of round-off.Testing
*right-associative incore/precedence.py, and reversing the operands inparser.py.rel=0.15test still passed.M.batch.py, thefrom first_errorchain inresult.py,catalog.py,plant.py). The two empty-file andthetatests were confirmed to execute their raise lines.main: every test file this branch touches, in the fast tier, withtest_spelling,test_suppressions,test_function_sizeandtest_rule_references: 470 passed.ruff check: clean.Found on the way, not changed here
evaluate_bsm1(plant, solution)with the defaultparams=NoneraisesKeyErroron a hand-builtPlantSolutionwhose plant hasn't built its parameter layout. The new energy test passesparamsexplicitly.test_recycle_cached_map.pycan't detect a wrongM, because their loop runs through a tank. The new fast test covers that.gw3crashed intest_precipitation.py::test_hydroxide_fraction_omits_species_and_precipitates. The test passes on its own, and three workers ran clean. Coverage from a crashed worker is lost, which made a first audit of untested raises overcount several-fold.Generated by Claude Code