@@ -360,9 +360,11 @@ def _test_persistence(self, a, chunks):
360
360
z3 [:] = 0
361
361
362
362
# check effect of write
363
- assert_array_equal (np .zeros_like (a ), z3 [:])
364
- assert_array_equal (np .zeros_like (a ), z2 [:])
365
- assert_array_equal (np .zeros_like (a ), z [:])
363
+ expect = np .empty_like (a )
364
+ expect [:] = 0
365
+ assert_array_equal (expect , z3 [:])
366
+ assert_array_equal (expect , z2 [:])
367
+ assert_array_equal (expect , z [:])
366
368
367
369
# open for writing (must not exist)
368
370
with assert_raises (ValueError ):
@@ -372,13 +374,22 @@ def _test_persistence(self, a, chunks):
372
374
shutil .rmtree (path )
373
375
374
376
def test_persistence_1d (self ):
377
+ # simple dtype
375
378
self ._test_persistence (np .arange (1050 ), chunks = (100 ,))
379
+ # structured dtype
380
+ dtype = np .dtype ([('a' , 'i4' ), ('b' , 'S10' )])
381
+ self ._test_persistence (np .empty (10000 , dtype = dtype ), chunks = (100 ,))
376
382
377
383
def test_persistence_2d (self ):
378
- a = np .arange (10000 ).reshape ((1000 , 10 ))
379
384
chunks = (100 , 2 )
385
+ # simple dtype
386
+ a = np .arange (10000 ).reshape ((1000 , 10 ))
380
387
self ._test_persistence (a , chunks = chunks )
381
-
388
+ # structured dtype
389
+ dtype = np .dtype ([('a' , 'i4' ), ('b' , 'S10' )])
390
+ self ._test_persistence (np .empty ((1000 , 10 ), dtype = dtype ),
391
+ chunks = chunks )
392
+
382
393
def test_resize_persistence (self ):
383
394
384
395
# setup path
0 commit comments