Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions numpy/core/tests/test_umath.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
import platform

from numpy.testing import *
import numpy.core.umath as ncu
Expand Down Expand Up @@ -401,10 +402,15 @@ def test_ldexp(self):
"python.org < 2.6 binaries have broken ldexp in the "
"C runtime")
def test_ldexp_overflow(self):
imax = np.iinfo(np.dtype('l')).max
imin = np.iinfo(np.dtype('l')).min
assert_equal(ncu.ldexp(2., imax), np.inf)
assert_equal(ncu.ldexp(2., imin), 0)
# silence warning emitted on overflow
err = np.seterr(over="ignore")
try:
imax = np.iinfo(np.dtype('l')).max
imin = np.iinfo(np.dtype('l')).min
assert_equal(ncu.ldexp(2., imax), np.inf)
assert_equal(ncu.ldexp(2., imin), 0)
finally:
np.seterr(**err)


class TestMaximum(TestCase):
Expand Down Expand Up @@ -644,7 +650,7 @@ def test_prepare(self):
class with_prepare(np.ndarray):
__array_priority__ = 10
def __array_prepare__(self, arr, context):
# make sure we can return a new
# make sure we can return a new
return np.array(arr).view(type=with_prepare)
a = np.array(1).view(type=with_prepare)
x = np.add(a, a)
Expand Down Expand Up @@ -991,7 +997,9 @@ def test_nextafter():
def test_nextafterf():
return _test_nextafter(np.float32)

@dec.knownfailureif(sys.platform == 'win32', "Long double support buggy on win32")
@dec.knownfailureif(sys.platform == 'win32' or
(sys.platform == "darwin" and "powerpc" in platform.processor()),
"Long double support buggy on win32 and OS X on PPC.")
def test_nextafterl():
return _test_nextafter(np.longdouble)

Expand All @@ -1016,7 +1024,9 @@ def test_spacing():
def test_spacingf():
return _test_spacing(np.float32)

@dec.knownfailureif(sys.platform == 'win32', "Long double support buggy on win32")
@dec.knownfailureif(sys.platform == 'win32' or
(sys.platform == "darwin" and "powerpc" in platform.processor()),
"Long double support buggy on win32 and OS X on PPC.")
def test_spacingl():
return _test_spacing(np.longdouble)

Expand Down Expand Up @@ -1082,16 +1092,16 @@ def test_reduceat():
h2 = np.array(h2)

# test buffered -- this should work
h1 = np.add.reduceat(a['value'], indx)
h1 = np.add.reduceat(a['value'], indx)
assert_array_almost_equal(h1, h2)

# This is when the error occurs.
# test no buffer
res = np.setbufsize(32)
h1 = np.add.reduceat(a['value'], indx)
np.setbufsize(np.UFUNC_BUFSIZE_DEFAULT)
np.setbufsize(np.UFUNC_BUFSIZE_DEFAULT)
assert_array_almost_equal(h1, h2)


def test_complex_nan_comparisons():
nans = [complex(np.nan, 0), complex(0, np.nan), complex(np.nan, np.nan)]
Expand Down
5 changes: 4 additions & 1 deletion numpy/core/tests/test_umath_complex.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
import platform

from numpy.testing import *
import numpy.core.umath as ncu
Expand All @@ -15,7 +16,9 @@
or (np.log(complex(np.NZERO, 0)).imag != np.pi))
# TODO: replace with a check on whether platform-provided C99 funcs are used
have_platform_functions = (sys.platform.startswith('win')
or sys.platform.startswith('sunos'))
or sys.platform.startswith('sunos')
or (sys.platform == 'darwin' and 'powerpc' in
platform.processor()))
skip_complex_tests = have_platform_functions and functions_seem_flaky

def platform_skip(func):
Expand Down