-
Notifications
You must be signed in to change notification settings - Fork 25
fix(py): read the axes wherever the version keeps them #661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
00cec97
fix(py): read the axes wherever the version keeps them
vboussot 0c13821
fix(py): resolve the intrinsic system by name and validate any orient…
vboussot db2840b
fix(py): treat only a null or empty orientation as undefined
vboussot 11d5307
test(py): resolve ValidationError through the optional-dependency guard
vboussot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) Fideus Labs LLC | ||
| # SPDX-License-Identifier: MIT | ||
| """Tests for the single place that locates the axes in raw metadata. | ||
|
|
||
| ``_raw_axes`` is what every reader and the conformance report use to find the | ||
| axes of a ``multiscales`` entry, so the version-dependent location is decided | ||
| once. The v0.6 case is the one that regressed: the axes moved into the | ||
| intrinsic coordinate system, and code that looked only for a flat ``axes`` key | ||
| silently found none. | ||
| """ | ||
|
|
||
| from ngff_zarr.parse_metadata import _raw_axes | ||
|
|
||
| _AXES = [{"name": "y", "type": "space"}, {"name": "x", "type": "space"}] | ||
|
|
||
|
|
||
| def test_flat_axes_are_returned(): | ||
| assert _raw_axes({"axes": _AXES}) == _AXES | ||
|
|
||
|
|
||
| def test_v06_axes_come_from_the_intrinsic_coordinate_system(): | ||
| entry = {"coordinateSystems": [{"name": "intrinsic", "axes": _AXES}]} | ||
| assert _raw_axes(entry) == _AXES | ||
|
|
||
|
|
||
| def test_a_flat_list_wins_over_coordinate_systems(): | ||
| """A document carrying both is read as the flat, pre-v0.6 shape.""" | ||
| entry = { | ||
| "axes": _AXES, | ||
| "coordinateSystems": [{"name": "other", "axes": [{"name": "t"}]}], | ||
| } | ||
| assert _raw_axes(entry) == _AXES | ||
|
|
||
|
|
||
| def test_entries_without_axes_yield_an_empty_list(): | ||
| assert _raw_axes({"datasets": [{"path": "0"}]}) == [] | ||
| assert _raw_axes({"coordinateSystems": []}) == [] | ||
| assert _raw_axes({"coordinateSystems": [{"name": "intrinsic"}]}) == [] | ||
| assert _raw_axes({"axes": "not a list"}) == [] | ||
| assert _raw_axes("not an entry") == [] | ||
|
|
||
|
|
||
| def test_axis_entries_are_returned_verbatim(): | ||
| """Malformed entries are passed through for the caller to classify.""" | ||
| entry = {"axes": ["not an object", {"name": 42}]} | ||
| assert _raw_axes(entry) == ["not an object", {"name": 42}] |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.