[pypy-commit] pypy py3k: merged upstream

alex_gaynor noreply at buildbot.pypy.org
Tue Nov 8 17:26:49 CET 2011


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: py3k
Changeset: r48954:5c7c60f852c7
Date: 2011-11-08 11:26 -0500
http://bitbucket.org/pypy/pypy/changeset/5c7c60f852c7/

Log:	merged upstream

diff --git a/pypy/module/_io/test/test_textio.py b/pypy/module/_io/test/test_textio.py
--- a/pypy/module/_io/test/test_textio.py
+++ b/pypy/module/_io/test/test_textio.py
@@ -215,6 +215,26 @@
         # that subprocess.Popen() can have the required unbuffered
         # semantics with universal_newlines=True.
         import _io
+        raw = self.get_MockRawIO()([b'abc', b'def', b'ghi\njkl\nopq\n'])
+        txt = _io.TextIOWrapper(raw, encoding='ascii', newline='\n')
+        # Reads
+        assert txt.read(4) == 'abcd'
+        assert txt.readline() == 'efghi\n'
+        assert list(txt) == ['jkl\n', 'opq\n']
+
+    def test_rawio_write_through(self):
+        # Issue #12591: with write_through=True, writes don't need a flush
+        import _io
+        raw = self.get_MockRawIO()([b'abc', b'def', b'ghi\njkl\nopq\n'])
+        txt = _io.TextIOWrapper(raw, encoding='ascii', newline='\n',
+                                write_through=True)
+        txt.write('1')
+        txt.write('23\n4')
+        txt.write('5')
+        assert b''.join(raw._write_stack) == b'123\n45'
+
+    def w_get_MockRawIO(self):
+        import _io
         class MockRawIO(_io._RawIOBase):
             def __init__(self, read_stack=()):
                 self._read_stack = list(read_stack)
@@ -275,24 +295,7 @@
                 except:
                     self._extraneous_reads += 1
                     return b""
-
-        raw = MockRawIO([b'abc', b'def', b'ghi\njkl\nopq\n'])
-        txt = _io.TextIOWrapper(raw, encoding='ascii', newline='\n')
-        # Reads
-        assert txt.read(4) == 'abcd'
-        assert txt.readline() == 'efghi\n'
-        assert list(txt) == ['jkl\n', 'opq\n']
-#
-#    def test_rawio_write_through(self):
-#        # Issue #12591: with write_through=True, writes don't need a flush
-#        import _io
-        raw = MockRawIO([b'abc', b'def', b'ghi\njkl\nopq\n'])
-        txt = _io.TextIOWrapper(raw, encoding='ascii', newline='\n',
-                                write_through=True)
-        txt.write('1')
-        txt.write('23\n4')
-        txt.write('5')
-        assert b''.join(raw._write_stack) == b'123\n45'
+        return MockRawIO
 
 
 class AppTestIncrementalNewlineDecoder:


More information about the pypy-commit mailing list