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

Method test_tofile_fromfile

numpy/_core/tests/test_records.py:349–360  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

347class TestPathUsage:
348 # Test that pathlib.Path can be used
349 def test_tofile_fromfile(self):
350 with temppath(suffix='.bin') as path:
351 path = Path(path)
352 np.random.seed(123)
353 a = np.random.rand(10).astype('f8,i4,S5')
354 a[5] = (0.5, 10, 'abcde')
355 with path.open("wb") as fd:
356 a.tofile(fd)
357 x = np._core.records.fromfile(
358 path, formats='f8,i4,S5', shape=10
359 )
360 assert_array_equal(x, a)
361
362
363class 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