zarr-developers / zarr-python

An implementation of chunked, compressed, N-dimensional arrays for Python.
http://zarr.readthedocs.io/
MIT License
1.41k stars 267 forks source link

array tests: handle different hexdigests from zlib-ng (#1678) #1972

Open AdamWill opened 4 weeks ago

AdamWill commented 4 weeks ago

As explained in the issue, zlib-ng produces different hex digests from original zlib. This adjusts the tests slightly to allow for this.

TODO:

Removed TODO items are irrelevant as this only changes tests. This is more or less the same as https://github.com/zarr-developers/zarr-python/pull/1971 , but for the main (v2) branch rather than v3 branch.

AdamWill commented 4 weeks ago

If I run black on the changed file here locally it does indeed want to change a bunch of stuff, but none of it is stuff this PR touches - the issues already exist.

d-v-b commented 4 weeks ago

Thanks for the fix. For posterity, the ideal way to handle two different versions of zlib would be to condition the test case on the detected zlib version, but our test design makes that very tedious and not worth the effort. I think what you have done here is good!

d-v-b commented 4 weeks ago

we are seeing test failures due to numpy 2.0 I think

AdamWill commented 4 weeks ago

yeah, it looks like numpy got some custom types. I guess you might need to do stuff like:

diff --git a/src/zarr/v2/core.py b/src/zarr/v2/core.py
index c1223dac..04da6749 100644
--- a/src/zarr/v2/core.py
+++ b/src/zarr/v2/core.py
@@ -759,7 +759,7 @@ class Array:

         Retrieve a single item::

-            >>> z.get_basic_selection(5)
+            >>> int(z.get_basic_selection(5))
             5

         Retrieve a region via slicing::

or something along those lines.