]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #20254: Fix duplicate tests in test_socket
authorBerker Peksag <berker.peksag@gmail.com>
Sun, 2 Oct 2016 08:39:41 +0000 (11:39 +0300)
committerBerker Peksag <berker.peksag@gmail.com>
Sun, 2 Oct 2016 08:39:41 +0000 (11:39 +0300)
Patch by Vajrasky Kok.

Lib/test/test_socket.py

index c5975c8c9e5613ea418d21e516f8b7dd9376fa1e..cce7d5213e9f7bad3b9a974c214107117340f346 100644 (file)
@@ -4629,9 +4629,10 @@ class BufferIOTest(SocketConnectedTest):
         SocketConnectedTest.__init__(self, methodName=methodName)
 
     def testRecvIntoArray(self):
-        buf = bytearray(1024)
+        buf = array.array("B", [0] * len(MSG))
         nbytes = self.cli_conn.recv_into(buf)
         self.assertEqual(nbytes, len(MSG))
+        buf = buf.tobytes()
         msg = buf[:len(MSG)]
         self.assertEqual(msg, MSG)
 
@@ -4658,9 +4659,10 @@ class BufferIOTest(SocketConnectedTest):
     _testRecvIntoMemoryview = _testRecvIntoArray
 
     def testRecvFromIntoArray(self):
-        buf = bytearray(1024)
+        buf = array.array("B", [0] * len(MSG))
         nbytes, addr = self.cli_conn.recvfrom_into(buf)
         self.assertEqual(nbytes, len(MSG))
+        buf = buf.tobytes()
         msg = buf[:len(MSG)]
         self.assertEqual(msg, MSG)