[pypy-svn] r76141 - pypy/branch/interplevel-array/pypy/module/array/test

hakanardo at codespeak.net hakanardo at codespeak.net
Mon Jul 12 15:28:32 CEST 2010


Author: hakanardo
Date: Mon Jul 12 15:28:30 2010
New Revision: 76141

Modified:
   pypy/branch/interplevel-array/pypy/module/array/test/test_array.py
Log:
buffer_info test

Modified: pypy/branch/interplevel-array/pypy/module/array/test/test_array.py
==============================================================================
--- pypy/branch/interplevel-array/pypy/module/array/test/test_array.py	(original)
+++ pypy/branch/interplevel-array/pypy/module/array/test/test_array.py	Mon Jul 12 15:28:30 2010
@@ -490,17 +490,13 @@
         b = pickle.loads(s)
         assert len(b) == 0 and b.typecode == 'l'
 
-    def test_misc(self):
+    def test_copy_swap(self):
         a = self.array('i', [1, 2, 3])
         from copy import copy
         b = copy(a)
         a[1] = 7
         assert repr(b) == "array('i', [1, 2, 3])"
 
-        bi=b.buffer_info()
-        assert bi[0] != 0 # FIXME: How can the address be tested?
-        assert bi[1] == 3
-
         for tc in 'bhilBHIL':
             a=self.array(tc, [1, 2, 3])
             a.byteswap()
@@ -574,7 +570,7 @@
 
 class AppTestArray(BaseArrayTests):
     def setup_class(cls):
-        cls.space = gettestobjspace(usemodules=('array', 'struct'))
+        cls.space = gettestobjspace(usemodules=('array', 'struct', '_rawffi'))
         cls.w_array = cls.space.appexec([], """():
             import array
             return array.array
@@ -583,4 +579,17 @@
             import struct
             return struct
         """)
+        cls.w_rffi = cls.space.appexec([], """():
+            import _rawffi
+            return _rawffi
+        """)
 
+
+    def test_buffer_info(self):
+        a = self.array('c', 'Hi!')
+        bi=a.buffer_info()
+        assert bi[0] != 0 
+        assert bi[1] == 3
+        data = self.rffi.charp2string(bi[0])
+        assert data == 'Hi!'
+        



More information about the Pypy-commit mailing list