Skip to content

Commit edaf467

Browse files
committed
Adjust test on truncate datagram
1 parent 72b2a99 commit edaf467

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎Lib/test/test_socket.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3310,8 +3310,8 @@ def _testRecvFromNegative(self):
33103310
@unittest.skipIf(sys.platform == "win32", "Windows raises WSAEMSGSIZE")
33113311
def testRecvTrunc(self):
33123312
# Truncated read where recv() returns the real size of the datagram
3313-
msg = self.serv.recv(5, socket.MSG_TRUNC)
3314-
self.assertEqual(msg, MSG[:5])
3313+
msg = self.serv.recv(len(MSG) - 5, socket.MSG_TRUNC)
3314+
self.assertEqual(msg, MSG[:-5])
33153315

33163316
# Read the whole second datagram
33173317
msg = self.serv.recv(len(MSG2) + 5, socket.MSG_TRUNC)
@@ -3325,8 +3325,8 @@ def _testRecvTrunc(self):
33253325
@unittest.skipIf(sys.platform == "win32", "Windows raises WSAEMSGSIZE")
33263326
def testRecvFromTrunc(self):
33273327
# Truncated read where recvfrom() returns the real size of the datagram
3328-
msg, addr = self.serv.recvfrom(5, socket.MSG_TRUNC)
3329-
self.assertEqual(msg, MSG[:5])
3328+
msg, addr = self.serv.recvfrom(len(MSG) - 5, socket.MSG_TRUNC)
3329+
self.assertEqual(msg, MSG[:-5])
33303330

33313331
# Read the whole second datagram
33323332
msg, addr = self.serv.recvfrom(len(MSG2) + 5, socket.MSG_TRUNC)

0 commit comments

Comments
 (0)