[pypy-svn] r79142 - in pypy/branch/fast-forward/pypy/module/_io: . test
afa at codespeak.net
afa at codespeak.net
Tue Nov 16 13:01:40 CET 2010
Author: afa
Date: Tue Nov 16 13:01:39 2010
New Revision: 79142
Modified:
pypy/branch/fast-forward/pypy/module/_io/interp_bytesio.py
pypy/branch/fast-forward/pypy/module/_io/test/test_bytesio.py
Log:
BytesIO() is readable, writable, seekable.
Modified: pypy/branch/fast-forward/pypy/module/_io/interp_bytesio.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/_io/interp_bytesio.py (original)
+++ pypy/branch/fast-forward/pypy/module/_io/interp_bytesio.py Tue Nov 16 13:01:39 2010
@@ -120,6 +120,18 @@
self.pos = 0
return space.wrap(self.pos)
+ @unwrap_spec('self', ObjSpace)
+ def readable_w(self, space):
+ return space.w_True
+
+ @unwrap_spec('self', ObjSpace)
+ def writable_w(self, space):
+ return space.w_True
+
+ @unwrap_spec('self', ObjSpace)
+ def seekable_w(self, space):
+ return space.w_True
+
W_BytesIO.typedef = TypeDef(
'BytesIO', W_BufferedIOBase.typedef,
__new__ = generic_new_descr(W_BytesIO),
@@ -130,5 +142,8 @@
getvalue = interp2app(W_BytesIO.getvalue_w),
seek = interp2app(W_BytesIO.seek_w),
tell = interp2app(W_BytesIO.tell_w),
+ readable = interp2app(W_BytesIO.readable_w),
+ writable = interp2app(W_BytesIO.writable_w),
+ seekable = interp2app(W_BytesIO.seekable_w),
)
Modified: pypy/branch/fast-forward/pypy/module/_io/test/test_bytesio.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/_io/test/test_bytesio.py (original)
+++ pypy/branch/fast-forward/pypy/module/_io/test/test_bytesio.py Tue Nov 16 13:01:39 2010
@@ -4,6 +4,14 @@
def setup_class(cls):
cls.space = gettestobjspace(usemodules=['_io'])
+ def test_capabilities(self):
+ import _io
+ f = _io.BytesIO()
+ assert f.readable()
+ assert f.writable()
+ assert f.seekable()
+ f.close()
+
def test_write(self):
import _io
f = _io.BytesIO()
More information about the Pypy-commit
mailing list