Skip to content

Commit af405f5

Browse files
committed
remove unneeded environment variables
1 parent 5cc2640 commit af405f5

File tree

2 files changed

+2
-55
lines changed

2 files changed

+2
-55
lines changed

zarr/tests/test_core.py

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from pkg_resources import parse_version
1919

2020
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
2222
from zarr.n5 import N5Store, N5FSStore, n5_keywords
2323
from zarr.storage import (
2424
ABSStore,
@@ -1007,11 +1007,6 @@ def test_array_dtype_shape(self):
10071007
def check_structured_array(self, d, fill_values):
10081008
for a in (d, d[:0]):
10091009
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
10151010
z = self.create_array(shape=a.shape, chunks=2, dtype=a.dtype, fill_value=fill_value)
10161011
assert len(a) == len(z)
10171012
assert a.shape == z.shape
@@ -1130,11 +1125,6 @@ def test_object_arrays(self):
11301125
with pytest.raises(ValueError):
11311126
self.create_array(shape=10, chunks=3, dtype=object)
11321127

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-
11381128
# an object_codec is required for object arrays, but allow to be provided via
11391129
# filters to maintain API backwards compatibility
11401130
with pytest.warns(FutureWarning):
@@ -1192,11 +1182,6 @@ def test_object_arrays(self):
11921182
def test_object_arrays_vlen_text(self):
11931183

11941184
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
12001185
z = self.create_array(shape=data.shape, dtype=object, object_codec=VLenUTF8())
12011186
z[0] = 'foo'
12021187
assert z[0] == 'foo'
@@ -1244,10 +1229,6 @@ def test_object_arrays_vlen_bytes(self):
12441229
greetings_bytes = [g.encode('utf8') for g in greetings]
12451230
data = np.array(greetings_bytes * 1000, dtype=object)
12461231

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
12511232
z = self.create_array(shape=data.shape, dtype=object, object_codec=VLenBytes())
12521233
z[0] = b'foo'
12531234
assert z[0] == b'foo'
@@ -1289,11 +1270,6 @@ def compare_arrays(expected, actual, item_dtype):
12891270
assert_array_equal(ev, av)
12901271
assert av.dtype == item_dtype
12911272

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-
12971273
codecs = VLenArray(int), VLenArray('<u4')
12981274
for codec in codecs:
12991275
z = self.create_array(shape=data.shape, dtype=object, object_codec=codec)
@@ -1317,12 +1293,6 @@ def compare_arrays(expected, actual, item_dtype):
13171293

13181294
def test_object_arrays_danger(self):
13191295

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-
13261296
# do something dangerous - manually force an object array with no object codec
13271297
z = self.create_array(shape=5, chunks=2, dtype=object, fill_value=0,
13281298
object_codec=MsgPack())
@@ -1367,11 +1337,6 @@ def test_structured_array_contain_object(self):
13671337
a = np.array([(b'aaa', 1),
13681338
(b'bbb', 2)], dtype=structured_dtype)
13691339

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-
13751340
# zarr-array with structured dtype require object codec
13761341
with pytest.raises(ValueError):
13771342
self.create_array(shape=a.shape, dtype=structured_dtype)
@@ -1520,16 +1485,6 @@ def test_attributes(self):
15201485
a.store.close()
15211486

15221487
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-
15331488
a = self.create_array(fill_value=(0.0, None),
15341489
shape=10,
15351490
chunks=10,

zarr/tests/test_core_v3.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
from zarr.core import Array
1313
from zarr.errors import ArrayNotFoundError, ContainsGroupError
14-
from zarr.meta import json_loads, ZARR_V3_ALLOW_COMPLEX, ZARR_V3_ALLOW_DATETIME
14+
from zarr.meta import json_loads
1515
from zarr.storage import (
1616
# ABSStoreV3,
1717
DBMStoreV3,
@@ -157,10 +157,6 @@ def test_dtypes(self):
157157

158158
# complex
159159
for dtype in 'c8', 'c16':
160-
if not ZARR_V3_ALLOW_COMPLEX:
161-
with pytest.raises(ValueError):
162-
self.create_array(shape=10, chunks=3, dtype=dtype)
163-
return
164160
z = self.create_array(shape=10, chunks=3, dtype=dtype)
165161
assert z.dtype == np.dtype(dtype)
166162
a = np.linspace(0, 1, z.shape[0], dtype=dtype)
@@ -173,10 +169,6 @@ def test_dtypes(self):
173169
for base_type in 'Mm':
174170
for resolution in 'D', 'us', 'ns':
175171
dtype = '{}8[{}]'.format(base_type, resolution)
176-
if not ZARR_V3_ALLOW_DATETIME:
177-
with pytest.raises(ValueError):
178-
self.create_array(shape=100, dtype=dtype, fill_value=0)
179-
return
180172
z = self.create_array(shape=100, dtype=dtype, fill_value=0)
181173
assert z.dtype == np.dtype(dtype)
182174
a = np.random.randint(np.iinfo('i8').min, np.iinfo('i8').max,

0 commit comments

Comments
 (0)