19
19
from zarr .meta import decode_array_metadata , encode_array_metadata , \
20
20
ZARR_FORMAT , decode_group_metadata , encode_group_metadata
21
21
from zarr .compat import text_type
22
- from zarr .compressors import default_compression
22
+ from zarr .storage import default_compression
23
+ from zarr .codecs import ZlibCompressor
23
24
24
25
25
26
class StoreTests (object ):
26
27
"""Abstract store tests."""
27
28
28
- # def create_store(self, **kwargs):
29
- # # implement in sub-class
30
- # pass
29
+ def create_store (self , ** kwargs ):
30
+ # implement in sub-class
31
+ raise NotImplementedError
31
32
32
33
def test_get_set_del_contains (self ):
33
34
store = self .create_store ()
@@ -230,8 +231,7 @@ def test_init_array(self):
230
231
eq ((1000 ,), meta ['shape' ])
231
232
eq ((100 ,), meta ['chunks' ])
232
233
eq (np .dtype (None ), meta ['dtype' ])
233
- eq (default_compression , meta ['compression' ])
234
- assert 'compression_opts' in meta
234
+ eq (default_compression , meta ['compression' ]['id' ])
235
235
assert_is_none (meta ['fill_value' ])
236
236
237
237
# check attributes
@@ -245,8 +245,7 @@ def test_init_array_overwrite(self):
245
245
dict (shape = (2000 ,),
246
246
chunks = (200 ,),
247
247
dtype = np .dtype ('u1' ),
248
- compression = 'zlib' ,
249
- compression_opts = 1 ,
248
+ compression = ZlibCompressor (1 ).get_config (),
250
249
fill_value = 0 ,
251
250
order = 'F' ,
252
251
filters = None )
@@ -283,8 +282,7 @@ def test_init_array_path(self):
283
282
eq ((1000 ,), meta ['shape' ])
284
283
eq ((100 ,), meta ['chunks' ])
285
284
eq (np .dtype (None ), meta ['dtype' ])
286
- eq (default_compression , meta ['compression' ])
287
- assert 'compression_opts' in meta
285
+ eq (default_compression , meta ['compression' ]['id' ])
288
286
assert_is_none (meta ['fill_value' ])
289
287
290
288
# check attributes
@@ -299,8 +297,7 @@ def test_init_array_overwrite_path(self):
299
297
meta = dict (shape = (2000 ,),
300
298
chunks = (200 ,),
301
299
dtype = np .dtype ('u1' ),
302
- compression = 'zlib' ,
303
- compression_opts = 1 ,
300
+ compression = ZlibCompressor (1 ).get_config (),
304
301
fill_value = 0 ,
305
302
order = 'F' ,
306
303
filters = None )
@@ -401,7 +398,6 @@ def test_init_array_compat(self):
401
398
compression_opts = 'foo' )
402
399
meta = decode_array_metadata (store [array_meta_key ])
403
400
assert_is_none (meta ['compression' ])
404
- assert_is_none (meta ['compression_opts' ])
405
401
406
402
def test_init_group (self ):
407
403
store = self .create_store ()
0 commit comments