summaryrefslogtreecommitdiff
path: root/Lib/test/mock_socket.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-02-10 22:11:21 +0100
committerGeorg Brandl <georg@python.org>2014-02-10 22:11:21 +0100
commitd8413bab22bb230fee0e96b9ebe870a485572777 (patch)
treeaf033d52a8fc4826f31ec20e507106178eafe5a2 /Lib/test/mock_socket.py
parentcf736f4e98f87e4a9006eb641723f7bad57edb42 (diff)
parentf0560d959299358b28234881340245dfa417558e (diff)
downloadcpython-git-d8413bab22bb230fee0e96b9ebe870a485572777.tar.gz
merge with 3.3
Diffstat (limited to 'Lib/test/mock_socket.py')
-rw-r--r--Lib/test/mock_socket.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/test/mock_socket.py b/Lib/test/mock_socket.py
index 8ef0ec8c8d..e36724f54b 100644
--- a/Lib/test/mock_socket.py
+++ b/Lib/test/mock_socket.py
@@ -21,8 +21,13 @@ class MockFile:
"""
def __init__(self, lines):
self.lines = lines
- def readline(self):
- return self.lines.pop(0) + b'\r\n'
+ def readline(self, limit=-1):
+ result = self.lines.pop(0) + b'\r\n'
+ if limit >= 0:
+ # Re-insert the line, removing the \r\n we added.
+ self.lines.insert(0, result[limit:-2])
+ result = result[:limit]
+ return result
def close(self):
pass