[pypy-svn] pypy fast-forward: Re-fix the test correctly.

amauryfa commits-noreply at bitbucket.org
Fri Jan 7 17:56:15 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: fast-forward
Changeset: r40466:89b14e1d6178
Date: 2011-01-07 17:51 +0100
http://bitbucket.org/pypy/pypy/changeset/89b14e1d6178/

Log:	Re-fix the test correctly. It's much easier this way

diff --git a/pypy/module/_file/test/test_file.py b/pypy/module/_file/test/test_file.py
--- a/pypy/module/_file/test/test_file.py
+++ b/pypy/module/_file/test/test_file.py
@@ -116,6 +116,18 @@
         f.close()
         assert f.newlines == "\r\n"
 
+        # now use readline()
+        f = self.file(self.temppath, "rU")
+        res = f.readline()
+        assert res == "\n"
+        # this tell() is necessary for CPython as well to update f.newlines
+        f.tell()
+        assert f.newlines == "\r\n"
+        res = f.readline()
+        assert res == ""
+        assert f.newlines == "\r\n"
+        f.close()
+
     def test_unicode(self):
         import os
         f = self.file(self.temppath, "w")

diff --git a/pypy/rlib/streamio.py b/pypy/rlib/streamio.py
--- a/pypy/rlib/streamio.py
+++ b/pypy/rlib/streamio.py
@@ -1013,6 +1013,7 @@
             pos += 1
             self.atcr = False
             if self.buf == "\n":
+                self.CRLF = True
                 self.buf = ""
         return pos - len(self.buf)
 


More information about the Pypy-commit mailing list