()
| 3545 | |
| 3546 | |
| 3547 | def test_memmap(): |
| 3548 | with tmpfile("npy") as fn_1: |
| 3549 | with tmpfile("npy") as fn_2: |
| 3550 | try: |
| 3551 | x = da.arange(100, chunks=15) |
| 3552 | target = np.memmap(fn_1, shape=x.shape, mode="w+", dtype=x.dtype) |
| 3553 | |
| 3554 | x.store(target) |
| 3555 | |
| 3556 | assert_eq(target, x, check_type=False) |
| 3557 | |
| 3558 | np.save(fn_2, target) |
| 3559 | |
| 3560 | assert_eq(np.load(fn_2, mmap_mode="r"), x, check_type=False) |
| 3561 | finally: |
| 3562 | target._mmap.close() |
| 3563 | |
| 3564 | |
| 3565 | def test_to_npy_stack(): |