MCPcopy Create free account
hub / github.com/numpy/numpy / test_save_load_memmap

Method test_save_load_memmap

numpy/lib/tests/test_io.py:2555–2567  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2553 assert_array_equal(data, a)
2554
2555 def test_save_load_memmap(self):
2556 # Test that pathlib.Path instances can be loaded mem-mapped.
2557 with temppath(suffix='.npy') as path:
2558 path = Path(path)
2559 a = np.array([[1, 2], [3, 4]], int)
2560 np.save(path, a)
2561 data = np.load(path, mmap_mode='r')
2562 assert_array_equal(data, a)
2563 # close the mem-mapped file
2564 del data
2565 if IS_PYPY:
2566 break_cycles()
2567 break_cycles()
2568
2569 @pytest.mark.xfail(IS_WASM, reason="memmap doesn't work correctly")
2570 def test_save_load_memmap_readwrite(self):

Callers

nothing calls this directly

Calls 3

temppathFunction · 0.90
assert_array_equalFunction · 0.90
break_cyclesFunction · 0.90

Tested by

no test coverage detected