Commit 055de7b8 authored by Dag Sverre Seljebotn's avatar Dag Sverre Seljebotn

Buffers: Update test-case strings, clean up endianness

parent 62ef7487
...@@ -454,17 +454,13 @@ def get_ts_check_item(dtype, writer): ...@@ -454,17 +454,13 @@ def get_ts_check_item(dtype, writer):
char = dtype.typestring char = dtype.typestring
if char is not None: if char is not None:
# Can use direct comparison # Can use direct comparison
if char is 'O':
byteorder = '|'
else:
byteorder = '1'
code = dedent("""\ code = dedent("""\
if (*ts == '%s') ++ts; if (*ts == '1') ++ts;
if (*ts != '%s') { if (*ts != '%s') {
PyErr_Format(PyExc_ValueError, "Buffer datatype mismatch (expecting '%s' got '%%s')", ts); PyErr_Format(PyExc_ValueError, "Buffer datatype mismatch (expected '%s', got '%%s')", ts);
return NULL; return NULL;
} else return ts + 1; } else return ts + 1;
""", 2) % (byteorder, char, char) """, 2) % (char, char)
else: else:
# Cannot trust declared size; but rely on int vs float and # Cannot trust declared size; but rely on int vs float and
# signed/unsigned to be correctly declared # signed/unsigned to be correctly declared
...@@ -541,7 +537,7 @@ def get_getbuffer_code(dtype, code): ...@@ -541,7 +537,7 @@ def get_getbuffer_code(dtype, code):
ts = __Pyx_ConsumeWhitespace(ts); ts = __Pyx_ConsumeWhitespace(ts);
if (*ts != 0) { if (*ts != 0) {
PyErr_Format(PyExc_ValueError, PyErr_Format(PyExc_ValueError,
"Expected non-struct buffer data type (rejecting on '%%s')", ts); "Expected non-struct buffer data type (expected end, got '%%s')", ts);
goto fail; goto fail;
} }
if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
......
...@@ -447,7 +447,7 @@ def fmtst1(buf): ...@@ -447,7 +447,7 @@ def fmtst1(buf):
>>> fmtst1(IntMockBuffer("A", range(3))) >>> fmtst1(IntMockBuffer("A", range(3)))
Traceback (most recent call last): Traceback (most recent call last):
... ...
ValueError: Buffer datatype mismatch (rejecting on 'i') ValueError: Buffer datatype mismatch (expected 'f', got 'i')
""" """
cdef object[float] a = buf cdef object[float] a = buf
...@@ -457,7 +457,7 @@ def fmtst2(object[int] buf): ...@@ -457,7 +457,7 @@ def fmtst2(object[int] buf):
>>> fmtst2(FloatMockBuffer("A", range(3))) >>> fmtst2(FloatMockBuffer("A", range(3)))
Traceback (most recent call last): Traceback (most recent call last):
... ...
ValueError: Buffer datatype mismatch (rejecting on 'f') ValueError: Buffer datatype mismatch (expected 'i', got 'f')
""" """
@testcase @testcase
......
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