Skip to content

Commit 6030328

Browse files
committed
added test for nested structured dtype
1 parent 35327f1 commit 6030328

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

zarr/tests/test_array.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,14 @@ def test_persistence_1d(self):
380380
a = np.arange(1050, dtype=dtype)
381381
self._test_persistence(a, chunks=(100,))
382382

383-
# structured dtype
384-
dtype = np.dtype([('a', 'i4'), ('b', 'S10')])
385-
a = np.empty(10000, dtype=dtype)
386-
self._test_persistence(a, chunks=(100,))
383+
# structured dtypes
384+
dtypes = [
385+
np.dtype([('a', 'i4'), ('b', 'S10')]),
386+
np.dtype([('a', 'i4'), ('b', [('c', '?'), ('d', 'S10')])]),
387+
]
388+
for dtype in dtypes:
389+
a = np.empty(10000, dtype=dtype)
390+
self._test_persistence(a, chunks=(100,))
387391

388392
def test_persistence_2d(self):
389393

@@ -392,10 +396,14 @@ def test_persistence_2d(self):
392396
a = np.arange(10000, dtype=dtype).reshape((1000, 10))
393397
self._test_persistence(a, chunks=(100, 2))
394398

395-
# structured dtype
396-
dtype = np.dtype([('a', 'i4'), ('b', 'S10')])
397-
a = np.empty((1000, 10), dtype=dtype)
398-
self._test_persistence(a, chunks=(100, 2))
399+
# structured dtypes
400+
dtypes = [
401+
np.dtype([('a', 'i4'), ('b', 'S10')]),
402+
np.dtype([('a', 'i4'), ('b', [('c', '?'), ('d', 'S10')])]),
403+
]
404+
for dtype in dtypes:
405+
a = np.empty((1000, 10), dtype=dtype)
406+
self._test_persistence(a, chunks=(100, 2))
399407

400408
def test_resize_persistence(self):
401409

0 commit comments

Comments
 (0)