-
Notifications
You must be signed in to change notification settings - Fork 28
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
Wire up Zarr property tests EAR-1189 #68
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
2bb8fe6
Wire up Zarr property tests
dcherian 1d02067
Cleanup
dcherian 708be50
fix hypothesis cache
dcherian a9af86d
Fix hypothesis CI
dcherian 707bd6a
temp
dcherian d18223d
update
dcherian 6dab2f0
Merge branch 'main' into zarr-prop-tests
dcherian 2fde481
Silence actionlint
dcherian 5cba96f
silence ruff
dcherian a28cda0
Merge branch 'main' into zarr-prop-tests
dcherian 061eeb6
updates
dcherian 2834596
lint
dcherian 19f8d2a
Merge branch 'main' into zarr-prop-tests
dcherian 0006c49
WIP
dcherian 0b5ca63
Merge branch 'main' into zarr-prop-tests
dcherian b8ea3ac
easy workflow lint
dcherian 941b897
sketchyworkflowlint
dcherian 0311a6f
Update icechunk-python/tests/test_zarr/test_properties.py
dcherian 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 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 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 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 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 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 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 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 |
---|---|---|
|
@@ -37,6 +37,7 @@ test = [ | |
"ruff", | ||
"dask", | ||
"distributed", | ||
"hypothesis", | ||
] | ||
|
||
[tool.maturin] | ||
|
This file contains 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,51 @@ | ||
import numpy as np | ||
import pytest | ||
from numpy.testing import assert_array_equal | ||
|
||
from icechunk import IcechunkStore, StorageConfig | ||
|
||
pytest.importorskip("hypothesis") | ||
|
||
import hypothesis.strategies as st | ||
from hypothesis import assume, given, settings | ||
|
||
from zarr.testing.strategies import arrays, numpy_arrays | ||
|
||
readable_characters = st.characters( | ||
# only use characters within the "Latin Extended-A" subset of unicode | ||
categories=["L", "N", "P"], | ||
max_codepoint=0x017F, | ||
) | ||
_attr_keys = st.text(readable_characters, min_size=1) | ||
_attr_values = st.recursive( | ||
st.none() | st.booleans() | st.text(readable_characters, min_size=1, max_size=5), | ||
lambda children: st.lists(children) | st.dictionaries(_attr_keys, children), | ||
max_leaves=3, | ||
) | ||
simple_attrs = st.none() | ||
|
||
icechunk_stores = st.builds( | ||
IcechunkStore.create, | ||
storage=st.builds(StorageConfig.memory, prefix=st.just("prefix")), | ||
read_only=st.just(False), | ||
) | ||
|
||
|
||
@settings(report_multiple_bugs=True, deadline=None) | ||
@given(data=st.data(), nparray=numpy_arrays(zarr_formats=st.just(3))) | ||
def test_roundtrip(data: st.DataObject, nparray) -> None: | ||
# TODO: support size-0 arrays GH392 | ||
assume(nparray.size > 0) | ||
# TODO: fix complex fill values GH391 | ||
assume(not np.iscomplexobj(nparray)) | ||
|
||
zarray = data.draw( | ||
arrays( | ||
stores=icechunk_stores, | ||
arrays=st.just(nparray), | ||
zarr_formats=st.just(3), | ||
# TODO: use all attrs once fixed GH393 | ||
attrs=simple_attrs, | ||
) | ||
) | ||
assert_array_equal(nparray, zarray[:]) |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome... we should embrace this for the other tests as well in the future