Commit d261cb62 authored by Berker Peksag's avatar Berker Peksag

Issue #20254: Merge from 3.5

parents aa7a55e7 480b0692
...@@ -4668,9 +4668,10 @@ class BufferIOTest(SocketConnectedTest): ...@@ -4668,9 +4668,10 @@ class BufferIOTest(SocketConnectedTest):
SocketConnectedTest.__init__(self, methodName=methodName) SocketConnectedTest.__init__(self, methodName=methodName)
def testRecvIntoArray(self): def testRecvIntoArray(self):
buf = bytearray(1024) buf = array.array("B", [0] * len(MSG))
nbytes = self.cli_conn.recv_into(buf) nbytes = self.cli_conn.recv_into(buf)
self.assertEqual(nbytes, len(MSG)) self.assertEqual(nbytes, len(MSG))
buf = buf.tobytes()
msg = buf[:len(MSG)] msg = buf[:len(MSG)]
self.assertEqual(msg, MSG) self.assertEqual(msg, MSG)
...@@ -4697,9 +4698,10 @@ class BufferIOTest(SocketConnectedTest): ...@@ -4697,9 +4698,10 @@ class BufferIOTest(SocketConnectedTest):
_testRecvIntoMemoryview = _testRecvIntoArray _testRecvIntoMemoryview = _testRecvIntoArray
def testRecvFromIntoArray(self): def testRecvFromIntoArray(self):
buf = bytearray(1024) buf = array.array("B", [0] * len(MSG))
nbytes, addr = self.cli_conn.recvfrom_into(buf) nbytes, addr = self.cli_conn.recvfrom_into(buf)
self.assertEqual(nbytes, len(MSG)) self.assertEqual(nbytes, len(MSG))
buf = buf.tobytes()
msg = buf[:len(MSG)] msg = buf[:len(MSG)]
self.assertEqual(msg, MSG) self.assertEqual(msg, MSG)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment