MCPcopy Index your code
hub / github.com/python/cpython / test_large_read

Method test_large_read

Lib/test/test_os/test_os.py:328–339  ·  view source on GitHub ↗
(self, size)

Source from the content-addressed store, hash-verified

326 "needs INT_MAX < PY_SSIZE_T_MAX")
327 @support.bigmemtest(size=INT_MAX + 10, memuse=1, dry_run=False)
328 def test_large_read(self, size):
329 self.addCleanup(os_helper.unlink, os_helper.TESTFN)
330 create_file(os_helper.TESTFN, b'test')
331
332 # Issue #21932: Make sure that os.read() does not raise an
333 # OverflowError for size larger than INT_MAX
334 with open(os_helper.TESTFN, "rb") as fp:
335 data = os.read(fp.fileno(), size)
336
337 # The test does not try to read more than 2 GiB at once because the
338 # operating system is free to return less bytes than requested.
339 self.assertEqual(data, b'test')
340
341
342 @support.cpython_only

Callers

nothing calls this directly

Calls 6

addCleanupMethod · 0.80
create_fileFunction · 0.70
openFunction · 0.50
readMethod · 0.45
filenoMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected