Example #1
0
 def it_returns_an_open_array_without_overwrite():
     with tmp.tmp_folder(chdir=True):
         ar = ArrayResult("test1", shape=(10, 5), dtype=np.uint8, mode="w+")
         fp = ar.arr()
         ar[:] = np.arange(10 * 5).astype(np.uint8).reshape((10, 5))
         _fp = ar.arr()
         assert _fp is fp
         ar.flush()
         assert local.path("test1").stat().st_size == 10 * 5
Example #2
0
 def it_resizes():
     with tmp.tmp_folder(chdir=True):
         ar = ArrayResult("test1", shape=(10, 5), dtype=np.uint8, mode="w+")
         ar[:] = np.arange(10 * 5).astype(np.uint8).reshape((10, 5))
         ar.reshape((4, 5))
         assert ar.shape == (4, 5)
         assert np.all(ar.arr() == np.arange(4 * 5).astype(np.uint8).reshape((4, 5)))