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

Method test_offset_overflow

Lib/test/test_os.py:3925–3940  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3923 self.assertEqual(self.server_buffer, expected)
3924
3925 async def test_offset_overflow(self):
3926 # specify an offset > file size
3927 offset = len(self.DATA) + 4096
3928 try:
3929 sent = await self.async_sendfile(self.sockno, self.fileno,
3930 offset, 4096)
3931 except OSError as e:
3932 # Solaris can raise EINVAL if offset >= file length, ignore.
3933 if e.errno != errno.EINVAL:
3934 raise
3935 else:
3936 self.assertEqual(sent, 0)
3937 self.client.shutdown(socket.SHUT_RDWR)
3938 self.client.close()
3939 await self.server.wait_closed()
3940 self.assertEqual(self.server_buffer, b'')
3941
3942 async def test_invalid_offset(self):
3943 with self.assertRaises(OSError) as cm:

Callers

nothing calls this directly

Calls 6

async_sendfileMethod · 0.95
lenFunction · 0.85
assertEqualMethod · 0.45
shutdownMethod · 0.45
closeMethod · 0.45
wait_closedMethod · 0.45

Tested by

no test coverage detected