[pypy-svn] pypy default: Remove this test, it is not correct.

alex_gaynor commits-noreply at bitbucket.org
Tue Feb 1 00:45:30 CET 2011


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: 
Changeset: r41511:eb503d8703af
Date: 2011-01-31 18:43 -0500
http://bitbucket.org/pypy/pypy/changeset/eb503d8703af/

Log:	Remove this test, it is not correct.

diff --git a/pypy/module/_io/test/test_io.py b/pypy/module/_io/test/test_io.py
--- a/pypy/module/_io/test/test_io.py
+++ b/pypy/module/_io/test/test_io.py
@@ -265,7 +265,7 @@
         import _io
 
         with _io.open(self.tmpfile, "w+") as f:
-            f.write("abc")
+            f.write(u"abc")
 
         with _io.open(self.tmpfile, "w+") as f:
             f.truncate()
@@ -288,13 +288,13 @@
         # The BOM is not written again when appending to a non-empty file
         for charset in ["utf-8-sig", "utf-16", "utf-32"]:
             with _io.open(self.tmpfile, "w", encoding=charset) as f:
-                f.write("aaa")
+                f.write(u"aaa")
                 pos = f.tell()
             with _io.open(self.tmpfile, "rb") as f:
                 res = f.read()
                 assert res == "aaa".encode(charset)
             with _io.open(self.tmpfile, "a", encoding=charset) as f:
-                f.write("xxx")
+                f.write(u"xxx")
             with _io.open(self.tmpfile, "rb") as f:
                 res = f.read()
                 assert res == "aaaxxx".encode(charset)
@@ -315,43 +315,3 @@
             assert res == "world\n"
             assert f.newlines == "\n"
             assert type(f.newlines) is unicode
-
-    def test_custom_decoder(self):
-        import codecs
-        import _io
-
-        class WeirdDecoder(codecs.IncrementalDecoder):
-            def decode(self, input, final=False):
-                return u".".join(input)
-
-        def weird_decoder(name):
-            if name == "test_decoder":
-                latin1 = codecs.lookup("latin-1")
-                return codecs.CodecInfo(
-                    name = "test_decoder",
-                    encode =latin1.encode,
-                    decode = None,
-                    incrementalencoder = None,
-                    streamreader = None,
-                    streamwriter = None,
-                    incrementaldecoder=WeirdDecoder
-                )
-
-        codecs.register(weird_decoder)
-
-        with _io.open(self.tmpfile, "wb") as f:
-            f.write("abcd")
-
-        with _io.open(self.tmpfile, encoding="test_decoder") as f:
-            decoded = f.read()
-
-        assert decoded == "a.b.c.d"
-        with _io.open(self.tmpfile, encoding="test_decoder") as f:
-            res = f.read(1)
-            assert res == "a"
-            cookie = f.tell()
-            res = f.read(1)
-            assert res == "."
-            f.seek(cookie)
-            res = f.read()
-            assert res == ".b.c.d"


More information about the Pypy-commit mailing list