[pypy-svn] r34135 - pypy/dist/pypy/rlib/test

cfbolz at codespeak.net cfbolz at codespeak.net
Fri Nov 3 18:08:52 CET 2006


Author: cfbolz
Date: Fri Nov  3 18:08:51 2006
New Revision: 34135

Modified:
   pypy/dist/pypy/rlib/test/test_streamio.py
Log:
crlf filter works out of the box


Modified: pypy/dist/pypy/rlib/test/test_streamio.py
==============================================================================
--- pypy/dist/pypy/rlib/test/test_streamio.py	(original)
+++ pypy/dist/pypy/rlib/test/test_streamio.py	Fri Nov  3 18:08:51 2006
@@ -549,23 +549,33 @@
         return func(*args)
 
 class TestLineBufferingOutputStreamLLinterp(BaseTestLineBufferingOutputStream,
-                                        LLRtypeMixin):
+                                            LLRtypeMixin):
     pass
     
 
-class TestCRLFFilter:
+class BaseTestCRLFFilter(BaseRtypingTest):
 
     def test_filter(self):
         packets = ["abc\ndef\rghi\r\nxyz\r", "123\r", "\n456"]
         expected = ["abc\ndef\nghi\nxyz\n", "123\n", "456"]
         crlf = streamio.CRLFFilter(TSource(packets))
-        blocks = []
-        while 1:
-            block = crlf.read(100)
-            if not block:
-                break
-            blocks.append(block)
-        assert blocks == expected
+        def f():
+            blocks = []
+            while 1:
+                block = crlf.read(100)
+                if not block:
+                    break
+                blocks.append(block)
+            assert blocks == expected
+        self.interpret(f, [])
+
+class TestCRLFFilter(BaseTestCRLFFilter):
+    def interpret(self, func, args, **kwds):
+        return func(*args)
+
+class TestCRLFFilterLLinterp(BaseTestCRLFFilter, LLRtypeMixin):
+    pass
+
 
 class TestMMapFile(BaseTestBufferingInputStreamTests):
     tfn = None



More information about the Pypy-commit mailing list