[pypy-svn] r79154 - in pypy/branch/fast-forward/pypy/module/_io: . test

afa at codespeak.net afa at codespeak.net
Tue Nov 16 17:37:55 CET 2010


Author: afa
Date: Tue Nov 16 17:37:53 2010
New Revision: 79154

Modified:
   pypy/branch/fast-forward/pypy/module/_io/interp_bufferedio.py
   pypy/branch/fast-forward/pypy/module/_io/test/test_bufferedio.py
Log:
Test and fix


Modified: pypy/branch/fast-forward/pypy/module/_io/interp_bufferedio.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/_io/interp_bufferedio.py	(original)
+++ pypy/branch/fast-forward/pypy/module/_io/interp_bufferedio.py	Tue Nov 16 17:37:53 2010
@@ -322,7 +322,6 @@
     def descr_init(self, space, w_raw, buffer_size=DEFAULT_BUFFER_SIZE):
         self.state = STATE_ZERO
         check_readable_w(space, w_raw)
-        space.call_method(w_raw, "_checkReadable")
 
         self.w_raw = w_raw
         self.buffer_size = buffer_size
@@ -549,7 +548,7 @@
             self._deprecated_max_buffer_size(space)
 
         self.state = STATE_ZERO
-        space.call_method(w_raw, "_checkWritable")
+        check_writable_w(space, w_raw)
 
         self.w_raw = w_raw
         self.buffer_size = buffer_size

Modified: pypy/branch/fast-forward/pypy/module/_io/test/test_bufferedio.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/_io/test/test_bufferedio.py	(original)
+++ pypy/branch/fast-forward/pypy/module/_io/test/test_bufferedio.py	Tue Nov 16 17:37:53 2010
@@ -205,9 +205,17 @@
         assert pair.write("abc") == 3
 
     def test_constructor_with_not_readable(self):
-        import _io, io
-        class NotReadable(io.BytesIO):
+        import _io
+        class NotReadable:
             def readable(self):
                 return False
 
         raises(IOError, _io.BufferedRWPair, NotReadable(), _io.BytesIO())
+
+    def test_constructor_with_not_writable(self):
+        import _io
+        class NotWritable:
+            def writable(self):
+                return False
+
+        raises(IOError, _io.BufferedRWPair, _io.BytesIO(), NotWritable())



More information about the Pypy-commit mailing list