[pypy-svn] r79331 - in pypy/branch/fast-forward/pypy/module/_io: . test
afa at codespeak.net
afa at codespeak.net
Mon Nov 22 10:42:20 CET 2010
Author: afa
Date: Mon Nov 22 10:42:18 2010
New Revision: 79331
Modified:
pypy/branch/fast-forward/pypy/module/_io/interp_textio.py
pypy/branch/fast-forward/pypy/module/_io/test/test_textio.py
Log:
Test and fix
Modified: pypy/branch/fast-forward/pypy/module/_io/interp_textio.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/_io/interp_textio.py (original)
+++ pypy/branch/fast-forward/pypy/module/_io/interp_textio.py Mon Nov 22 10:42:18 2010
@@ -350,7 +350,7 @@
return u""
available = len(self.decoded_chars) - self.decoded_chars_used
- if available < 0 or size > available:
+ if size < 0 or size > available:
size = available
if self.decoded_chars_used > 0 or size < available:
Modified: pypy/branch/fast-forward/pypy/module/_io/test/test_textio.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/_io/test/test_textio.py (original)
+++ pypy/branch/fast-forward/pypy/module/_io/test/test_textio.py Mon Nov 22 10:42:18 2010
@@ -69,6 +69,14 @@
reads.append(c)
assert u''.join(reads) == u"abc\ndef\ng"
+ def test_read_some_then_all(self):
+ import _io
+ r = _io.BytesIO("abc\ndef\n")
+ t = _io.TextIOWrapper(r)
+ reads = t.read(4)
+ reads += t.read()
+ assert reads == u"abc\ndef\n"
+
class AppTestIncrementalNewlineDecoder:
def test_newline_decoder(self):
More information about the Pypy-commit
mailing list