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

Method test_roundtrip

numpy/core/tests/test_memmap.py:32–44  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

30 break_cycles()
31
32 def test_roundtrip(self):
33 # Write data to file
34 fp = memmap(self.tmpfp, dtype=self.dtype, mode='w+',
35 shape=self.shape)
36 fp[:] = self.data[:]
37 del fp # Test __del__ machinery, which handles cleanup
38
39 # Read data back from file
40 newfp = memmap(self.tmpfp, dtype=self.dtype, mode='r',
41 shape=self.shape)
42 assert_(allclose(self.data, newfp))
43 assert_array_equal(self.data, newfp)
44 assert_equal(newfp.flags.writeable, False)
45
46 def test_open_with_filename(self, tmp_path):
47 tmpname = tmp_path / 'mmap'

Callers

nothing calls this directly

Calls 5

memmapClass · 0.90
assert_Function · 0.90
allcloseFunction · 0.90
assert_array_equalFunction · 0.90
assert_equalFunction · 0.90

Tested by

no test coverage detected