diff options
author | Robert Kern <robert.kern@gmail.com> | 2008-05-19 20:40:56 +0000 |
---|---|---|
committer | Robert Kern <robert.kern@gmail.com> | 2008-05-19 20:40:56 +0000 |
commit | 7ee9981d88525a9b09df86643c15306e1e5f5e58 (patch) | |
tree | 1b1b36ce20c15030a1feb3fa773f91bcd2421a41 /numpy/core | |
parent | 4856e097f52311da379779fd3a99c5a00a1d26b6 (diff) | |
download | numpy-7ee9981d88525a9b09df86643c15306e1e5f5e58.tar.gz |
Use endian-specific dtypes in tests which construct cross-type views.
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/tests/test_multiarray.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index 166c3269b..ec5b47658 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -837,7 +837,8 @@ class TestView(NumpyTestCase): def test_basic(self): x = np.array([(1,2,3,4),(5,6,7,8)],dtype=[('r',np.int8),('g',np.int8), ('b',np.int8),('a',np.int8)]) - y = x.view(dtype=np.int32) + # We must be specific about the endianness here: + y = x.view(dtype='<i4') z = x.view(np.int32) assert_array_equal(y,z) assert_array_equal(y, [67305985, 134678021]) @@ -848,7 +849,8 @@ class TestView(NumpyTestCase): def test_keywords(self): x = np.array([(1,2)],dtype=[('a',np.int8),('b',np.int8)]) - y = x.view(dtype=np.int16, type=np.matrix) + # We must be specific about the endianness here: + y = x.view(dtype='<i2', type=np.matrix) assert_array_equal(y,[[513]]) assert(isinstance(y,np.matrix)) |