(self, tmp_path, param_filename)
| 6222 | assert_array_equal(y, x.flat) |
| 6223 | |
| 6224 | def test_largish_file(self, tmp_path, param_filename): |
| 6225 | # check the fallocate path on files > 16MB |
| 6226 | tmp_filename = normalize_filename(tmp_path, param_filename) |
| 6227 | d = np.zeros(4 * 1024 ** 2) |
| 6228 | d.tofile(tmp_filename) |
| 6229 | assert_equal(os.path.getsize(tmp_filename), d.nbytes) |
| 6230 | assert_array_equal(d, np.fromfile(tmp_filename)) |
| 6231 | # check offset |
| 6232 | with open(tmp_filename, "r+b") as f: |
| 6233 | f.seek(d.nbytes) |
| 6234 | d.tofile(f) |
| 6235 | assert_equal(os.path.getsize(tmp_filename), d.nbytes * 2) |
| 6236 | # check append mode (gh-8329) |
| 6237 | open(tmp_filename, "w").close() # delete file contents |
| 6238 | with open(tmp_filename, "ab") as f: |
| 6239 | d.tofile(f) |
| 6240 | assert_array_equal(d, np.fromfile(tmp_filename)) |
| 6241 | with open(tmp_filename, "ab") as f: |
| 6242 | d.tofile(f) |
| 6243 | assert_equal(os.path.getsize(tmp_filename), d.nbytes * 2) |
| 6244 | |
| 6245 | def test_io_open_buffered_fromfile(self, tmp_path, param_filename): |
| 6246 | # gh-6632 |
nothing calls this directly
no test coverage detected