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

Method test_tofile_fromfile

numpy/core/tests/test_records.py:325–336  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

323class TestPathUsage:
324 # Test that pathlib.Path can be used
325 def test_tofile_fromfile(self):
326 with temppath(suffix='.bin') as path:
327 path = Path(path)
328 np.random.seed(123)
329 a = np.random.rand(10).astype('f8,i4,a5')
330 a[5] = (0.5,10,'abcde')
331 with path.open("wb") as fd:
332 a.tofile(fd)
333 x = np.core.records.fromfile(path,
334 formats='f8,i4,a5',
335 shape=10)
336 assert_array_equal(x, a)
337
338
339class TestRecord:

Callers

nothing calls this directly

Calls 5

temppathFunction · 0.90
assert_array_equalFunction · 0.90
astypeMethod · 0.80
tofileMethod · 0.80
openMethod · 0.45

Tested by

no test coverage detected