Skip to content

test(v1): co-locate §6 masked-addend tests, pin fallback-guard messages#853

Merged
FBumann merged 1 commit into
feat/arithmetic-conventionfrom
test/v1-consolidate-absence-tests
Jul 20, 2026
Merged

test(v1): co-locate §6 masked-addend tests, pin fallback-guard messages#853
FBumann merged 1 commit into
feat/arithmetic-conventionfrom
test/v1-consolidate-absence-tests

Conversation

@FBumann

@FBumann FBumann commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

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 into TestAbsencePropagation in test_legacy_violations.py — where the rest of §6 lives — sharing one ab_all_masked fixture. Net −4 inline setups.

#6 — pin the fallback-guard messages. The four bare pytest.raises(ValueError) guards on the use_fallback=True DataFrame-grouper path accepted any ValueError. Added match="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) and TestConstraintCoordinateAlignment (test_constraints.py, ~100 lines) into test_legacy_violations.py is not a mechanical move: both depend on conftest's preloaded m/v (m.variables["v"]), while test_legacy_violations.py shadows m with an empty Model(). Relocating them there raises KeyError. 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 skipped
  • pytest test/test_linear_expression.py → green
  • ruff check clean; pre-commit hooks pass

…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>
@FBumann
FBumann merged commit 71df679 into feat/arithmetic-convention Jul 20, 2026
1 of 2 checks passed
@FBumann
FBumann deleted the test/v1-consolidate-absence-tests branch July 20, 2026 08:18
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