Commit 89ca9093 authored by Stefan Behnel's avatar Stefan Behnel

Py3 test fix

parent 39bac725
......@@ -5,6 +5,8 @@
Test slicing for memoryviews and memoryviewslices
"""
import sys
cimport numpy as np
import numpy as np
cimport cython
......@@ -423,9 +425,13 @@ cdef packed struct StructArray:
def test_memslice_structarray(data, dtype):
"""
>>> def b(s): return s.encode('ascii')
>>> def to_byte_values(b):
... if sys.version_info[0] >= 3: return list(b)
... else: return map(ord, b)
>>> data = [(range(4), b('spam\\0')), (range(4, 8), b('ham\\0\\0')), (range(8, 12), b('eggs\\0'))]
>>> dtype = np.dtype([('a', '4i'), ('b', '5b')])
>>> test_memslice_structarray([(L, list(map(ord, s))) for L, s in data], dtype)
>>> test_memslice_structarray([(L, to_byte_values(s))) for L, s in data], dtype)
0
1
2
......
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