MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_large_read

Method test_large_read

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

Source from the content-addressed store, hash-verified

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