18
18
from pkg_resources import parse_version
19
19
20
20
from zarr .core import Array
21
- from zarr .meta import json_loads , ZARR_V3_ALLOW_OBJECTARRAY , ZARR_V3_ALLOW_STRUCTURED
21
+ from zarr .meta import json_loads
22
22
from zarr .n5 import N5Store , N5FSStore , n5_keywords
23
23
from zarr .storage import (
24
24
ABSStore ,
@@ -1007,11 +1007,6 @@ def test_array_dtype_shape(self):
1007
1007
def check_structured_array (self , d , fill_values ):
1008
1008
for a in (d , d [:0 ]):
1009
1009
for fill_value in fill_values :
1010
- if self ._version == 3 and not ZARR_V3_ALLOW_STRUCTURED :
1011
- with pytest .raises (ValueError ):
1012
- self .create_array (shape = a .shape , chunks = 2 , dtype = a .dtype ,
1013
- fill_value = fill_value )
1014
- return
1015
1010
z = self .create_array (shape = a .shape , chunks = 2 , dtype = a .dtype , fill_value = fill_value )
1016
1011
assert len (a ) == len (z )
1017
1012
assert a .shape == z .shape
@@ -1130,11 +1125,6 @@ def test_object_arrays(self):
1130
1125
with pytest .raises (ValueError ):
1131
1126
self .create_array (shape = 10 , chunks = 3 , dtype = object )
1132
1127
1133
- if self ._version == 3 and not ZARR_V3_ALLOW_OBJECTARRAY :
1134
- with pytest .raises (ValueError ):
1135
- self .create_array (shape = 10 , chunks = 3 , dtype = object , filters = [MsgPack ()])
1136
- return
1137
-
1138
1128
# an object_codec is required for object arrays, but allow to be provided via
1139
1129
# filters to maintain API backwards compatibility
1140
1130
with pytest .warns (FutureWarning ):
@@ -1192,11 +1182,6 @@ def test_object_arrays(self):
1192
1182
def test_object_arrays_vlen_text (self ):
1193
1183
1194
1184
data = np .array (greetings * 1000 , dtype = object )
1195
-
1196
- if self ._version == 3 and not ZARR_V3_ALLOW_OBJECTARRAY :
1197
- with pytest .raises (ValueError ):
1198
- self .create_array (shape = data .shape , dtype = object , object_codec = VLenUTF8 ())
1199
- return
1200
1185
z = self .create_array (shape = data .shape , dtype = object , object_codec = VLenUTF8 ())
1201
1186
z [0 ] = 'foo'
1202
1187
assert z [0 ] == 'foo'
@@ -1244,10 +1229,6 @@ def test_object_arrays_vlen_bytes(self):
1244
1229
greetings_bytes = [g .encode ('utf8' ) for g in greetings ]
1245
1230
data = np .array (greetings_bytes * 1000 , dtype = object )
1246
1231
1247
- if self ._version == 3 and not ZARR_V3_ALLOW_OBJECTARRAY :
1248
- with pytest .raises (ValueError ):
1249
- self .create_array (shape = data .shape , dtype = object , object_codec = VLenBytes ())
1250
- return
1251
1232
z = self .create_array (shape = data .shape , dtype = object , object_codec = VLenBytes ())
1252
1233
z [0 ] = b'foo'
1253
1234
assert z [0 ] == b'foo'
@@ -1289,11 +1270,6 @@ def compare_arrays(expected, actual, item_dtype):
1289
1270
assert_array_equal (ev , av )
1290
1271
assert av .dtype == item_dtype
1291
1272
1292
- if self ._version == 3 and not ZARR_V3_ALLOW_OBJECTARRAY :
1293
- with pytest .raises (ValueError ):
1294
- self .create_array (shape = data .shape , dtype = object , object_codec = VLenArray ('<u4' ))
1295
- return
1296
-
1297
1273
codecs = VLenArray (int ), VLenArray ('<u4' )
1298
1274
for codec in codecs :
1299
1275
z = self .create_array (shape = data .shape , dtype = object , object_codec = codec )
@@ -1317,12 +1293,6 @@ def compare_arrays(expected, actual, item_dtype):
1317
1293
1318
1294
def test_object_arrays_danger (self ):
1319
1295
1320
- if self ._version == 3 and not ZARR_V3_ALLOW_OBJECTARRAY :
1321
- with pytest .raises (ValueError ):
1322
- self .create_array (shape = 5 , chunks = 2 , dtype = object , fill_value = 0 ,
1323
- object_codec = MsgPack ())
1324
- return
1325
-
1326
1296
# do something dangerous - manually force an object array with no object codec
1327
1297
z = self .create_array (shape = 5 , chunks = 2 , dtype = object , fill_value = 0 ,
1328
1298
object_codec = MsgPack ())
@@ -1367,11 +1337,6 @@ def test_structured_array_contain_object(self):
1367
1337
a = np .array ([(b'aaa' , 1 ),
1368
1338
(b'bbb' , 2 )], dtype = structured_dtype )
1369
1339
1370
- if self ._version == 3 and not ZARR_V3_ALLOW_STRUCTURED :
1371
- with pytest .raises (ValueError ):
1372
- self .create_array (shape = a .shape , dtype = structured_dtype )
1373
- return
1374
-
1375
1340
# zarr-array with structured dtype require object codec
1376
1341
with pytest .raises (ValueError ):
1377
1342
self .create_array (shape = a .shape , dtype = structured_dtype )
@@ -1520,16 +1485,6 @@ def test_attributes(self):
1520
1485
a .store .close ()
1521
1486
1522
1487
def test_structured_with_object (self ):
1523
- if self ._version == 3 and not (ZARR_V3_ALLOW_OBJECTARRAY
1524
- and ZARR_V3_ALLOW_STRUCTURED ):
1525
- with pytest .raises (ValueError ):
1526
- self .create_array (fill_value = (0.0 , None ),
1527
- shape = 10 ,
1528
- chunks = 10 ,
1529
- dtype = [('x' , float ), ('y' , object )],
1530
- object_codec = Pickle ())
1531
- return
1532
-
1533
1488
a = self .create_array (fill_value = (0.0 , None ),
1534
1489
shape = 10 ,
1535
1490
chunks = 10 ,
0 commit comments