From 56eb63f02e05277a8d24f1a60fe1159fc36b4bda Mon Sep 17 00:00:00 2001 From: Dag Sverre Seljebotn Date: Thu, 24 Sep 2009 21:50:25 +0200 Subject: [PATCH] Failing numpy.pxd dtype serialization testcase --- tests/run/numpy_test.pyx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/run/numpy_test.pyx b/tests/run/numpy_test.pyx index ec3909c4..cc85db7f 100644 --- a/tests/run/numpy_test.pyx +++ b/tests/run/numpy_test.pyx @@ -199,6 +199,10 @@ try: 1,1 1,1 8,16 + + >>> test_point_record() + array([(0.0, 0.0), (1.0, -1.0), (2.0, -2.0)], + dtype=[('x', '!f8'), ('y', '!f8')]) """ except: @@ -392,4 +396,15 @@ def test_complextypes(): print "%d,%d" % (sizeof(x64), sizeof(x128)) - +cdef struct Point: + np.float64_t x, y + +def test_point_record(): + cdef np.ndarray[Point] test + Point_dtype = np.dtype([('x', np.float64), ('y', np.float64)]) + test = np.zeros(3, Point_dtype) + cdef int i + for i in range(3): + test[i].x = i + test[i].y = -i + print repr(test).replace('<', '!').replace('>', '!') -- 2.26.2