The current numpy_test.pyx file fails for PowerPC macs due to
endianness issues in the dtype.  This is a small fix to make it work
(and make all tests pass on my machine).  It also adds an explicit
big-endian test to the doctest.

diff -r fc73225aaea1 tests/run/numpy_test.pyx
--- a/tests/run/numpy_test.pyx  Fri Apr 17 09:11:16 2009 +0200
+++ b/tests/run/numpy_test.pyx  Fri Apr 17 15:43:11 2009 -0500
@@ -132,13 +132,20 @@
     >>> test_recordarray()

     >>> test_nested_dtypes(np.zeros((3,), dtype=np.dtype([\
-            ('a', np.dtype('i,i')),\
-            ('b', np.dtype('i,i'))\
+            ('a', np.dtype('<i,<i')),\
+            ('b', np.dtype('<i,<i'))\
         ])))
     array([((0, 0), (0, 0)), ((1, 2), (1, 4)), ((1, 2), (1, 4))],
           dtype=[('a', [('f0', '<i4'), ('f1', '<i4')]), ('b', [('f0',
'<i4'), ('f1', '<i4')])])

     >>> test_nested_dtypes(np.zeros((3,), dtype=np.dtype([\
+            ('a', np.dtype('>i,>i')),\
+            ('b', np.dtype('>i,>i'))\
+        ])))
+    array([((0, 0), (0, 0)), ((1, 2), (1, 4)), ((1, 2), (1, 4))],
+          dtype=[('a', [('f0', '>i4'), ('f1', '>i4')]), ('b', [('f0',
'>i4'), ('f1', '>i4')])])
+
+    >>> test_nested_dtypes(np.zeros((3,), dtype=np.dtype([\
             ('a', np.dtype('i,f')),\
             ('b', np.dtype('i,i'))\
         ])))
@@ -297,6 +304,10 @@
     arr[1].b.x = arr[0].a.y + 1
     arr[1].b.y = 4
     arr[2] = arr[1]
+    if not arr.dtype.isnative:
+        # required to get the endianness
+        # indicator (< or >) correct in output.
+        arr.byteswap(True)
     return arr

 def test_bad_nested_dtypes():
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to