test(alignment): assert coord values, not just dims - #902
Conversation
Merging this PR will regress 2 benchmarks
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Memory | test_to_lp[merge_balance-severity=0] |
2.6 MB | 3.2 MB | -17.84% |
| ❌ | Memory | test_to_lp[nodal_balance-severity=50] |
2.9 MB | 3.3 MB | -12.12% |
| ⚡ | Memory | test_to_lp[masked-n=100] |
2.7 MB | 2.1 MB | +29.09% |
| ⚡ | Memory | test_to_lp[milp-n=50] |
2.6 MB | 2.1 MB | +28.18% |
| ⚡ | Memory | test_to_lp[cumsum-severity=50] |
62.5 MB | 50 MB | +24.96% |
| ⚡ | Memory | test_to_lp[knapsack-n=10000] |
2.7 MB | 2.2 MB | +18.02% |
| ⚡ | Memory | test_build[knapsack-n=100] |
5.5 KB | 4.7 KB | +17.07% |
| ⚡ | Memory | test_to_lp[storage-n=250] |
30.3 MB | 27.3 MB | +10.79% |
| ⚡ | Memory | test_build[knapsack-n=10000] |
830.3 KB | 752.2 KB | +10.39% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing test/coords-value-assertions (d3f2e6d) with master (f06738e)2
Footnotes
-
175 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
-
No successful run was found on
master(09c34dd) during the generation of this report, so f06738e was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
Build cost — v1 vs legacyv1 build peak & time relative to legacy, on this commit — not a comparison against master (that is CodSpeed).
Full table (time + peak, mean)📊 Interactive plots + CSV: download the semantics-report-v1-vs-legacy artifact from this run. Report-only · not a gate · refreshed on every push · obsolete once legacy is dropped. |
test_coords_set_variable_dims asserted which dimensions each coords form produces, but never the values behind them — a coords form that silently reordered or re-typed its entries passed. Carry a dim -> values mapping per case instead of a dims tuple, and assert the resulting index against it, so both halves of the contract are pinned for every form. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
@peterhron-sf Just for your information, We are doing a follow up also touching your code. We kept it out of your PR because it was not an issue with your tests, but the method you added some test cases to. |
dbd4609 to
d3f2e6d
Compare
The test also compares the coord values, on top of the existing dim names now
Note
The following content was generated by AI.
Follow-up to #897, now rebased onto master since that merged — the diff here
is one commit touching only
test/test_alignment.py.TestAddVariablesCoords.test_coords_set_variable_dimsasserted whichdimensions each coords form produces, but never the values behind them. A
coords form that silently reordered, re-typed or truncated its entries passed.
Each case now carries a
dim -> valuesmapping instead of a dims tuple, andthe test asserts the resulting index against it, so both halves of the
contract are pinned for all 14 forms — including the three timezone-aware
ones from #897, where the value assertion is what actually catches #898.
Reverting #897's
_as_indexchange fails thexarray-datetime-utcandxarray-datetime-dstcases under both the legacy and v1 conventions; with it,the file is 228 passed / 14 skipped and the suite 5253 passed / 493 skipped.
The DST-spanning hourly range is @peterhron's from #897, kept as-is and
lifted into a module-level
_hourly_indexso the expected column can reuse it.Checklist
AGENTS.md).doc.doc/release_notes.rstof the upcoming release is included. — n/a, test-only; the note for the fix landed with fix: _as_index() calls to_index() for DataArrays #897.