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

Method test_unseekable_fromfile

numpy/core/tests/test_multiarray.py:5364–5374  ·  view source on GitHub ↗
(self, x, tmp_filename)

Source from the content-addressed store, hash-verified

5362 assert_array_equal(x, y)
5363
5364 def test_unseekable_fromfile(self, x, tmp_filename):
5365 # gh-6246
5366 x.tofile(tmp_filename)
5367
5368 def fail(*args, **kwargs):
5369 raise OSError('Can not tell or seek')
5370
5371 with io.open(tmp_filename, 'rb', buffering=0) as f:
5372 f.seek = fail
5373 f.tell = fail
5374 assert_raises(OSError, np.fromfile, f, dtype=x.dtype)
5375
5376 def test_io_open_unbuffered_fromfile(self, x, tmp_filename):
5377 # gh-6632

Callers

nothing calls this directly

Calls 3

assert_raisesFunction · 0.90
tofileMethod · 0.80
openMethod · 0.45

Tested by

no test coverage detected