MCPcopy Index your code
hub / github.com/numpy/numpy / test_roundtrip_file

Method test_roundtrip_file

numpy/_core/tests/test_multiarray.py:6150–6158  ·  view source on GitHub ↗
(self, tmp_path, param_filename)

Source from the content-addressed store, hash-verified

6148 assert_(y.size == 0, "Array not empty")
6149
6150 def test_roundtrip_file(self, tmp_path, param_filename):
6151 tmp_filename = normalize_filename(tmp_path, param_filename)
6152 x = self._create_data()
6153 with open(tmp_filename, 'wb') as f:
6154 x.tofile(f)
6155 # NB. doesn't work with flush+seek, due to use of C stdio
6156 with open(tmp_filename, 'rb') as f:
6157 y = np.fromfile(f, dtype=x.dtype)
6158 assert_array_equal(y, x.flat)
6159
6160 def test_roundtrip(self, tmp_path, param_filename):
6161 tmp_filename = normalize_filename(tmp_path, param_filename)

Callers

nothing calls this directly

Calls 5

_create_dataMethod · 0.95
assert_array_equalFunction · 0.90
normalize_filenameFunction · 0.85
openFunction · 0.85
tofileMethod · 0.80

Tested by

no test coverage detected