Commit 6bcc8fd8 authored by Robert Bradshaw's avatar Robert Bradshaw

Fix tests due to buffer char format change.

parent b0539cbc
......@@ -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
......
......@@ -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:
......
......@@ -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:
......
......@@ -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
......
......@@ -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]
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment