summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2016-10-02 08:39:41 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2016-10-02 08:39:41 (GMT)
commit480b0692701317637189180ec5df296ec71487e0 (patch)
tree01f67eaf214c6ae06f72e2bf58d068b7cec3f918 /Lib/test
parentd556a352424c92d18ecfefdfeaf08db3ddf1c95f (diff)
downloadcpython-480b0692701317637189180ec5df296ec71487e0.zip
cpython-480b0692701317637189180ec5df296ec71487e0.tar.gz
cpython-480b0692701317637189180ec5df296ec71487e0.tar.bz2
Issue #20254: Fix duplicate tests in test_socket
Patch by Vajrasky Kok.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_socket.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index c5975c8..cce7d52 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -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)