summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-06-12 21:29:43 (GMT)
committerGuido van Rossum <guido@python.org>2002-06-12 21:29:43 (GMT)
commitab659966db75b265798d8f773035bc5952fd093d (patch)
treea4e868edecb62cea0aa7ec8271e221fccde8b1a6 /Lib
parent284a2cf07fe3cf8d8acdd8cbb1d3e6a357dff662 (diff)
downloadcpython-ab659966db75b265798d8f773035bc5952fd093d.zip
cpython-ab659966db75b265798d8f773035bc5952fd093d.tar.gz
cpython-ab659966db75b265798d8f773035bc5952fd093d.tar.bz2
Remove some overly complicated ways to concatenate and repeat strings
using "".join(). Fold a long line.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_socket.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 34d5f76..6beadd2 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -51,8 +51,9 @@ class ThreadableTest:
self.queue = Queue.Queue(1)
# Do some munging to start the client test.
- test_method = getattr(self, ''.join(('_', self._TestCase__testMethodName)))
- self.client_thread = thread.start_new_thread(self.clientRun, (test_method, ))
+ test_method = getattr(self, '_' + self._TestCase__testMethodName)
+ self.client_thread = thread.start_new_thread(
+ self.clientRun, (test_method,))
self.__setUp()
self.ready.wait()
@@ -281,7 +282,7 @@ class BasicTCPTest(SocketConnectedTest):
"""Testing receive in chunks over TCP."""
seg1 = self.cli_conn.recv(len(MSG) - 3)
seg2 = self.cli_conn.recv(1024)
- msg = ''.join ((seg1, seg2))
+ msg = seg1 + seg2
self.assertEqual(msg, MSG)
def _testOverFlowRecv(self):
@@ -301,7 +302,7 @@ class BasicTCPTest(SocketConnectedTest):
"""Testing recvfrom() in chunks over TCP."""
seg1, addr = self.cli_conn.recvfrom(len(MSG)-3)
seg2, addr = self.cli_conn.recvfrom(1024)
- msg = ''.join((seg1, seg2))
+ msg = seg1 + seg2
hostname, port = addr
##self.assertEqual(hostname, socket.gethostbyname('localhost'))
self.assertEqual(msg, MSG)
@@ -320,7 +321,7 @@ class BasicTCPTest(SocketConnectedTest):
self.assert_(len(read) == 1024, "Error performing sendall.")
def _testSendAll(self):
- big_chunk = ''.join([ 'f' ] * 2048)
+ big_chunk = 'f' * 2048
self.serv_conn.sendall(big_chunk)
def testFromFd(self):
@@ -473,7 +474,7 @@ class FileObjectClassTestCase(SocketConnectedTest):
"""Performing small file read test."""
first_seg = self.serv_file.read(len(MSG)-3)
second_seg = self.serv_file.read(3)
- msg = ''.join((first_seg, second_seg))
+ msg = first_seg + second_seg
self.assertEqual(msg, MSG)
def _testSmallRead(self):