diff options
| author | Georg Brandl <georg@python.org> | 2014-02-10 21:04:20 (GMT) |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2014-02-10 21:04:20 (GMT) |
| commit | 8f9c20b8ff6d00a32ff3f4018969e80e237884dc (patch) | |
| tree | 9e5670bfca7ba58b303de5bd470f5088afe419f2 /Lib/test/mock_socket.py | |
| parent | 72e7761301febe026536e7a2a444269698dcf156 (diff) | |
| parent | a37fcb28e6bcfd7705f219c12834b4d23a9ed499 (diff) | |
| download | cpython-8f9c20b8ff6d00a32ff3f4018969e80e237884dc.zip cpython-8f9c20b8ff6d00a32ff3f4018969e80e237884dc.tar.gz cpython-8f9c20b8ff6d00a32ff3f4018969e80e237884dc.tar.bz2 | |
merge with 3.3.4 releasing repo
Diffstat (limited to 'Lib/test/mock_socket.py')
| -rw-r--r-- | Lib/test/mock_socket.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/test/mock_socket.py b/Lib/test/mock_socket.py index d09e78c..861bfb2 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 |
