test(v1): co-locate §6 masked-addend tests, pin fallback-guard messages#853
Merged
FBumann merged 1 commit intoJul 20, 2026
Merged
Conversation
…sages Follow-up polish for the #717 "polish the tests" checklist: - Move the four masked-addend §6 tests (absence propagation of a fully masked term in a sum) out of test_linear_expression.py into TestAbsencePropagation in test_legacy_violations.py, where the rest of the §6 coverage lives. They now share one `ab_all_masked` fixture instead of rebuilding an inline two-variable model four times. - Add `match="only supported for"` to the four bare `pytest.raises(ValueError)` guards on the `use_fallback=True` DataFrame-grouper path, so they assert *why* the fallback raises rather than accepting any ValueError. The fifth guard (issue #351) keeps its precise `(KeyError, IndexError)` — its message is an incidental numpy index error, brittle to pin. No behaviour change; test_legacy_violations.py 294 passed, test_linear_expression.py green, ruff clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Second batch of test polish for the #717 checklist item "polish the tests". Stacked on #852. No behaviour change.
Note
The following was generated by AI.
#5 — co-locate §6 coverage. Four masked-addend tests (absence propagation of a fully masked term in a sum) lived loose in
test_linear_expression.py, each rebuilding the same inline two-variable model. Moved them intoTestAbsencePropagationintest_legacy_violations.py— where the rest of §6 lives — sharing oneab_all_maskedfixture. Net −4 inline setups.#6 — pin the fallback-guard messages. The four bare
pytest.raises(ValueError)guards on theuse_fallback=TrueDataFrame-grouper path accepted any ValueError. Addedmatch="only supported for"so they assert why the fallback rejects the grouper. The fifth guard (issue #351) keeps its precise(KeyError, IndexError)— its message is an incidental numpy index error, brittle to pin.#4 deferred (not in this PR). Consolidating
TestCoordinateAlignment(test_linear_expression.py, ~500 lines) andTestConstraintCoordinateAlignment(test_constraints.py, ~100 lines) intotest_legacy_violations.pyis not a mechanical move: both depend on conftest's preloadedm/v(m.variables["v"]), whiletest_legacy_violations.pyshadowsmwith an emptyModel(). Relocating them there raisesKeyError. It needs deliberate fixture reconciliation plus a ~600-line diff, so it belongs in its own focused PR.Verification
pytest test/test_legacy_violations.py→ 294 passed, 166 skippedpytest test/test_linear_expression.py→ greenruff checkclean; pre-commit hooks pass