Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def verify_dtypes(self, chunk_size=None):
n = 100
if chunk_size is None:
chunk_size = 100
dtypes = [np.int8, np.uint8, np.int32, np.uint32, np.float64, np.float32]
source = {
str(dtype): zarr.array(np.arange(n, dtype=dtype), chunks=(chunk_size,))
for dtype in dtypes
}
dest = self.verify_round_trip(source)
for dtype in dtypes:
self.assertEqual(dest[str(dtype)].dtype, dtype)
def test_3d_array(self):
a = zarr.array(np.arange(27).reshape((3, 3, 3)))
self.verify_round_trip({"a": a})
def test_2d_array_chunk_size_10_10(self):
a = zarr.array(np.arange(100).reshape((10, 10)), chunks=(5, 10))
self.verify_round_trip({"a": a})
def test_2d_array(self):
a = zarr.array(np.arange(100).reshape((10, 10)))
self.verify_round_trip({"a": a})
def test_3d_array_chunks_size_1_1_1(self):
a = zarr.array(np.arange(27).reshape((3, 3, 3)), chunks=(1, 1, 1))
self.verify_round_trip({"a": a})