Fix tests due to buffer char format change.
authorRobert Bradshaw <robertwb@math.washington.edu>
Fri, 10 Aug 2012 18:44:46 +0000 (11:44 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Fri, 10 Aug 2012 18:44:46 +0000 (11:44 -0700)
tests/buffers/bufaccess.pyx
tests/buffers/buffmt.pyx
tests/buffers/mockbuffers.pxi
tests/memoryview/memoryview.pyx
tests/memoryview/memoryviewattrs.pyx
tests/memoryview/memslice.pyx

index 4c4ff4d..3418804 100644 (file)
@@ -1034,7 +1034,7 @@ def basic_struct(object[MyStruct] buf):
 
     >>> basic_struct(MyStructMockBuffer(None, [(1, 2, 3, 4, 5)]))
     1 2 3 4 5
-    >>> basic_struct(MyStructMockBuffer(None, [(1, 2, 3, 4, 5)], format="bbqii"))
+    >>> basic_struct(MyStructMockBuffer(None, [(1, 2, 3, 4, 5)], format="ccqii"))
     1 2 3 4 5
     """
     print buf[0].a, buf[0].b, buf[0].c, buf[0].d, buf[0].e
index 8ffaad2..86f31fb 100644 (file)
@@ -63,7 +63,7 @@ def _int(fmt):
     >>> _int("b")
     Traceback (most recent call last):
        ...
-    ValueError: Buffer dtype mismatch, expected 'int' but got 'char'
+    ValueError: Buffer dtype mismatch, expected 'int' but got 'signed char'
 
     >>> _int("if")
     Traceback (most recent call last):
@@ -184,13 +184,13 @@ def char3int(fmt):
 def unpacked_struct(fmt):
     """
     Native formats:
-    >>> unpacked_struct("biZffbiii")
-    >>> unpacked_struct("@bi3fb3i")
-    >>> unpacked_struct("@biZffbi2i")
-    >>> unpacked_struct("biZffT{biii}")
-    >>> unpacked_struct("bT{ifffb2i}i")
-    >>> unpacked_struct("biZffb3T{i}")
-    >>> unpacked_struct("T{b}T{T{iZffT{bi}}}2T{T{i}}")
+    >>> unpacked_struct("ciZffciii")
+    >>> unpacked_struct("@ci3fc3i")
+    >>> unpacked_struct("@ciZffci2i")
+    >>> unpacked_struct("ciZffT{ciii}")
+    >>> unpacked_struct("cT{ifffc2i}i")
+    >>> unpacked_struct("ciZffc3T{i}")
+    >>> unpacked_struct("T{c}T{T{iZffT{ci}}}2T{T{i}}")
     """
 
     assert (sizeof(UnpackedStruct1) == sizeof(UnpackedStruct2)
@@ -303,7 +303,7 @@ def packed_struct(fmt):
     Assuming int is four bytes:
 
     >>> packed_struct("^cici")
-    >>> packed_struct("=cibi")
+    >>> packed_struct("=cici")
 
     However aligned access won't work:
 
index fcb5962..bf145b1 100644 (file)
@@ -280,7 +280,7 @@ cdef class MyStructMockBuffer(MockBuffer):
         return 0
 
     cdef get_itemsize(self): return sizeof(MyStruct)
-    cdef get_default_format(self): return b"2bq2i"
+    cdef get_default_format(self): return b"2cq2i"
 
 cdef class NestedStructMockBuffer(MockBuffer):
     cdef int write(self, char* buf, object value) except -1:
index db560cd..00e0427 100644 (file)
@@ -237,7 +237,7 @@ def basic_struct(MyStruct[:] mslice):
 
     >>> basic_struct(MyStructMockBuffer(None, [(1, 2, 3, 4, 5)]))
     [('a', 1), ('b', 2), ('c', 3), ('d', 4), ('e', 5)]
-    >>> basic_struct(MyStructMockBuffer(None, [(1, 2, 3, 4, 5)], format="bbqii"))
+    >>> basic_struct(MyStructMockBuffer(None, [(1, 2, 3, 4, 5)], format="ccqii"))
     [('a', 1), ('b', 2), ('c', 3), ('d', 4), ('e', 5)]
     """
     buf = mslice
index 772b23e..b2ce03a 100644 (file)
@@ -30,13 +30,13 @@ def test_shape_stride_suboffset():
     77 11 1
     -1 -1 -1
     '''
-    cdef char[:,:,:] larr = array((5,7,11), 1, 'b')
+    cdef char[:,:,:] larr = array((5,7,11), 1, 'c')
     print larr.shape[0], larr.shape[1], larr.shape[2]
     print larr.strides[0], larr.strides[1], larr.strides[2]
     print larr.suboffsets[0], larr.suboffsets[1], larr.suboffsets[2]
     print
 
-    larr = array((5,7,11), 1, 'b', mode='fortran')
+    larr = array((5,7,11), 1, 'c', mode='fortran')
     print larr.shape[0], larr.shape[1], larr.shape[2]
     print larr.strides[0], larr.strides[1], larr.strides[2]
     print larr.suboffsets[0], larr.suboffsets[1], larr.suboffsets[2]
index a32e639..e459fdb 100644 (file)
@@ -1008,7 +1008,7 @@ def basic_struct(MyStruct[:] buf):
 
     >>> basic_struct(MyStructMockBuffer(None, [(1, 2, 3, 4, 5)]))
     1 2 3 4 5
-    >>> basic_struct(MyStructMockBuffer(None, [(1, 2, 3, 4, 5)], format="bbqii"))
+    >>> basic_struct(MyStructMockBuffer(None, [(1, 2, 3, 4, 5)], format="ccqii"))
     1 2 3 4 5
     """
     print buf[0].a, buf[0].b, buf[0].c, buf[0].d, buf[0].e