Commit b3c8e6c9 authored by scoder's avatar scoder

Merge pull request #164 from strohel/master

Add test for memoryview of extension type
parents 8788d538 de905040
# mode: run
# tag: numpy
import numpy as np
cdef class ExtensionType(object):
cdef public int dummy
def __init__(self, n):
self.dummy = n
items = [ExtensionType(1), ExtensionType(2)]
cdef ExtensionType[:] view = np.array(items, dtype=ExtensionType)
def test_getitem():
"""
>>> test_getitem()
1
2
"""
for i in range(view.shape[0]):
item = view[i]
print item.dummy
def test_getitem_typed():
"""
>>> test_getitem_typed()
1
2
"""
cdef ExtensionType item
for i in range(view.shape[0]):
item = view[i]
print item.dummy
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