Commit d2f7faf
test: make charge_state assertion order-agnostic for linopy 0.8
linopy 0.8.0 (PR PyPSA/linopy#732, "unify coords-as-truth handling")
makes the explicit `coords` argument the single source of truth for
variable dimension ordering. Previously `add_variables` inherited the
dim order from the `lower`/`upper` bound DataArrays when present.
`charge_state` is the only Storage variable created with explicit bound
arrays, which are built time-leading via `expand_dims('time')` /
`concat(dim='time')`. So on linopy <0.8 it came back as (time, cluster),
inconsistent with every other variable (e.g. flow_rate is (cluster,
time)). On >=0.8 it follows the coords order -> (cluster, time),
resolving that inconsistency.
The test hard-coded the old order and indexed positionally. Switch to
label-based access (isel(cluster=...)) and assert the dim set rather
than its order, so the test passes on both linopy 0.7 and 0.8.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent b6d66d8 commit d2f7faf
1 file changed
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
339 | | - | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
340 | 342 | | |
341 | 343 | | |
342 | | - | |
343 | | - | |
344 | | - | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
345 | 347 | | |
346 | 348 | | |
347 | 349 | | |
| |||
0 commit comments