cython-devel

changeset 2138:3b30f5aaf47a

Failing numpy.pxd dtype serialization testcase
author Dag Sverre Seljebotn <dagss@student.matnat.uio.no>
date Thu Sep 24 21:50:25 2009 +0200 (3 years ago)
parents 71980dd690eb
children 2ffa48b4073a
files tests/run/numpy_test.pyx
line diff
1.1 --- a/tests/run/numpy_test.pyx Tue Sep 22 02:13:13 2009 -0700 1.2 +++ b/tests/run/numpy_test.pyx Thu Sep 24 21:50:25 2009 +0200 1.3 @@ -199,6 +199,10 @@ 1.4 1,1 1.5 1,1 1.6 8,16 1.7 + 1.8 + >>> test_point_record() 1.9 + array([(0.0, 0.0), (1.0, -1.0), (2.0, -2.0)], 1.10 + dtype=[('x', '!f8'), ('y', '!f8')]) 1.11 1.12 """ 1.13 except: 1.14 @@ -392,4 +396,15 @@ 1.15 print "%d,%d" % (sizeof(x64), sizeof(x128)) 1.16 1.17 1.18 - 1.19 +cdef struct Point: 1.20 + np.float64_t x, y 1.21 + 1.22 +def test_point_record(): 1.23 + cdef np.ndarray[Point] test 1.24 + Point_dtype = np.dtype([('x', np.float64), ('y', np.float64)]) 1.25 + test = np.zeros(3, Point_dtype) 1.26 + cdef int i 1.27 + for i in range(3): 1.28 + test[i].x = i 1.29 + test[i].y = -i 1.30 + print repr(test).replace('<', '!').replace('>', '!')