8000 Merge pull request #10443 from ahaldane/big_endian_fixes · numpy/numpy@c3fd791 · GitHub
[go: up one dir, main page]

Skip to content

Commit c3fd791

Browse files
authored
Merge pull request #10443 from ahaldane/big_endian_fixes
BUG: Fix various Big-Endian test failures (ppc64)
2 parents 4e175ab + d03e465 commit c3fd791

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

numpy/core/tests/test_arrayprint.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class sub(np.ndarray): pass
2828
' [3, 4]])')
2929

3030
# two dimensional with flexible dtype
31-
xstruct = np.ones((2,2), dtype=[('a', 'i4')]).view(sub)
31+
xstruct = np.ones((2,2), dtype=[('a', '<i4')]).view(sub)
3232
assert_equal(repr(xstruct),
3333
"sub([[(1,), (1,)],\n"
3434
" [(1,), (1,)]], dtype=[('a', '<i4')])"
@@ -362,13 +362,14 @@ def test_formatter_reset(self):
362362

363363
def test_0d_arrays(self):
364364
unicode = type(u'')
365-
assert_equal(unicode(np.array(u'café', np.unicode_)), u'café')
365+
366+
assert_equal(unicode(np.array(u'café', '<U4')), u'café')
366367

367368
if sys.version_info[0] >= 3:
368-
assert_equal(repr(np.array('café', np.unicode_)),
369+
assert_equal(repr(np.array('café', '<U4')),
369370
"array('café', dtype='<U4')")
370371
else:
371-
assert_equal(repr(np.array(u'café', np.unicode_)),
372+
assert_equal(repr(np.array(u'café', '<U4')),
372373
"array(u'caf\\xe9', dtype='<U4')")
373374
assert_equal(str(np.array('test', np.str_)), 'test')
374375

@@ -477,7 +478,7 @@ def test_float_overflow_nowarn(self):
477478
repr(np.array([1e4, 0.1], dtype='f2'))
478479

479480
def test_sign_spacing_structured(self):
480-
a = np.ones(2, dtype='f,f')
481+
a = np.ones(2, dtype='<f,<f')
481482
assert_equal(repr(a),
482483
"array([(1., 1.), (1., 1.)], dtype=[('f0', '<f4'), ('f1', '<f4')])")
483484
assert_equal(repr(a[0]), "(1., 1.)")

numpy/core/tests/test_dtype.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def test_dtype(self):
4040
assert_(dt.byteorder != dt2.byteorder, "bogus test")
4141
assert_dtype_equal(dt, dt2)
4242
else:
43-
self.assertTrue(dt.byteorder != dt3.byteorder, "bogus test")
43+
assert_(dt.byteorder != dt3.byteorder, "bogus test")
4444
assert_dtype_equal(dt, dt3)
4545

4646
def test_equivalent_dtype_hashing(self):

numpy/core/tests/test_records.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ def test_recarray_repr(self):
124124
assert_(repr(a).find('dtype=int32') != -1)
125125

126126
def test_0d_recarray_repr(self):
127-
# testing infered integer types is unpleasant due to sizeof(int) varying
128-
arr_0d = np.rec.array((np.int32(1), 2.0, np.datetime64('2003')))
127+
arr_0d = np.rec.array((1, 2.0, '2003'), dtype='<i4,<f8,<M8[Y]')
129128
assert_equal(repr(arr_0d), textwrap.dedent("""\
130129
rec.array((1, 2., '2003'),
131130
dtype=[('f0', '<i4'), ('f1', '<f8'), ('f2', '<M8[Y]')])"""))

numpy/core/tests/test_scalarmath.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import warnings
55
import itertools
66
import operator
7+
import platform
78

89
import numpy as np
910
from numpy.testing import (
@@ -420,6 +421,7 @@ def test_int_from_infinite_longdouble___int__(self):
420421
assert_raises(OverflowError, x.__int__)
421422
assert_equal(len(sup.log), 1)
422423

424+
@dec.knownfailureif(platform.machine().startswith("ppc64"))
423425
@dec.skipif(np.finfo(np.double) == np.finfo(np.longdouble))
424426
def test_int_from_huge_longdouble(self):
425427
# Produce a longdouble that would overflow a double,

0 commit comments

Comments
 (0)
0