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

Method test_roundtrip_file

numpy/core/tests/test_multiarray.py:5321–5327  ·  view source on GitHub ↗
(self, x, tmp_filename)

Source from the content-addressed store, hash-verified

5319 assert_(y.size == 0, "Array not empty")
5320
5321 def test_roundtrip_file(self, x, tmp_filename):
5322 with open(tmp_filename, 'wb') as f:
5323 x.tofile(f)
5324 # NB. doesn't work with flush+seek, due to use of C stdio
5325 with open(tmp_filename, 'rb') as f:
5326 y = np.fromfile(f, dtype=x.dtype)
5327 assert_array_equal(y, x.flat)
5328
5329 def test_roundtrip(self, x, tmp_filename):
5330 x.tofile(tmp_filename)

Callers

nothing calls this directly

Calls 3

assert_array_equalFunction · 0.90
openFunction · 0.85
tofileMethod · 0.80

Tested by

no test coverage detected