diff options
author | Larry Hastings <larry@hastings.org> | 2014-02-11 00:15:46 -0800 |
---|---|---|
committer | Larry Hastings <larry@hastings.org> | 2014-02-11 00:15:46 -0800 |
commit | 3f99504c08ebca685271c32289f8907bc456e1fc (patch) | |
tree | deb0b2d3284cec1323ad0da34f96107ea3f64576 /Lib/test/mock_socket.py | |
parent | 4cce8f2f40cc15235f44b3a47fec0444ed75e9fe (diff) | |
parent | 06847d9c8c30715c077e083de1c511e399af75f1 (diff) | |
download | cpython-git-3f99504c08ebca685271c32289f8907bc456e1fc.tar.gz |
Merge Python 3.4.0rc1 release branch.
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 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 |