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

Method test_tofile_sep

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

Source from the content-addressed store, hash-verified

6495 assert_array_equal(y, v)
6496
6497 def test_tofile_sep(self, tmp_path, param_filename, decimal_sep_localization):
6498 tmp_filename = normalize_filename(tmp_path, param_filename)
6499 x = np.array([1.51, 2, 3.51, 4], dtype=float)
6500 with open(tmp_filename, 'w') as f:
6501 x.tofile(f, sep=',')
6502 with open(tmp_filename, 'r') as f:
6503 s = f.read()
6504 #assert_equal(s, '1.51,2.0,3.51,4.0')
6505 y = np.array([float(p) for p in s.split(',')])
6506 assert_array_equal(x, y)
6507
6508 def test_tofile_format(self, tmp_path, param_filename, decimal_sep_localization):
6509 tmp_filename = normalize_filename(tmp_path, param_filename)

Callers

nothing calls this directly

Calls 6

assert_array_equalFunction · 0.90
normalize_filenameFunction · 0.85
openFunction · 0.85
tofileMethod · 0.80
splitMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected