-
-
Notifications
You must be signed in to change notification settings - Fork 263
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
Add example hypothesis roundtrip test #1746
base: v3
Are you sure you want to change the base?
Conversation
Hello @dcherian! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2024-04-05 17:47:12 UTC |
tests/test_properties.py
Outdated
elif path == "/": | ||
assert name is not None | ||
array_path = name | ||
array_name = "/" + name | ||
else: | ||
assert name is not None | ||
array_path = f"{path}/{name}" | ||
array_name = "/" + array_path |
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.
totally not obvious!
0a97842
to
42b88dc
Compare
1. Roundtrip a numpy array 2. Basic Indexing
This is important for zarr-developers#1931
This reverts commit 2ad1b35.
42b88dc
to
a772880
Compare
4e71735
to
bd90c6a
Compare
Some input needed:
|
# TODO: clean this up | ||
if path is None and name is None: |
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.
Can this mess be cleaned up?
assert isinstance(a, Array) | ||
assert nparray.shape == a.shape | ||
# assert chunks == a.chunks # TODO: adapt for v2, v3 | ||
assert array_path == a.path | ||
assert array_name == a.name | ||
# assert a.basename is None # TODO | ||
# assert a.store == normalize_store_arg(store) | ||
assert dict(a.attrs) == expected_attrs |
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.
Would be good to decide what invariants to check here. Potentially could move out to its own test.
# TODO: FIXME seems to break with booleans and timedelta | ||
# fill_value=nparray.dtype.type(0), |
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 seems to be a bug.
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.
the boolean issue is probably a bug, would be good to see if we can extract a standalone reproducer.
Some input here would be very helpful |
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.
Long overdue. Thanks @dcherian for working on this. Once this is in, I'd love some guidance on writing a similar thing for the store tests.
# TODO: FIXME seems to break with booleans and timedelta | ||
# fill_value=nparray.dtype.type(0), |
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.
the boolean issue is probably a bug, would be good to see if we can extract a standalone reproducer.
* v3: (22 commits) [v3] `Buffer` ensure correct subclass based on the `BufferPrototype` argument (zarr-developers#1974) Fix doc build (zarr-developers#1987) Fix doc build warnings (zarr-developers#1985) Automatically generate API reference docs (zarr-developers#1918) Update `RemoteStore.__str__` and add UPath tests (zarr-developers#1964) [v3] Elevate codec pipeline (zarr-developers#1932) 0 dim arrays: indexing (zarr-developers#1980) `parse_shapelike` allows 0 (zarr-developers#1979) Clean up typing and docs for indexing (zarr-developers#1961) add json indentation to config (zarr-developers#1952) chore: update pre-commit hooks (zarr-developers#1973) Bump pypa/gh-action-pypi-publish in the actions group (zarr-developers#1969) chore: update pre-commit hooks (zarr-developers#1957) Update release.rst (zarr-developers#1960) doc: update release notes for 3.0.0.alpha (zarr-developers#1959) Basic working FsspecStore (zarr-developers#1785) Feature: Top level V3 API (zarr-developers#1884) Buffer Prototype Argument (zarr-developers#1910) Create issue-metrics.yml fixes bug in transpose (zarr-developers#1949) ...
After
mamba install hypothesis
Use
to see all the things it tries.
This was a quick attempt at a property test.
The other thing you can do is a "Stateful" test (e.g. https://github.com/pydata/xarray/blob/main/properties/test_index_manipulation.py)
which runs an arbitrary sequence of manipulations (e.g. add array, rename, move, delete, modify array, copy), and checks for consistency at each point.
cc @Zac-HD
TODO: