summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Gommers <ralf.gommers@googlemail.com>2013-01-02 20:36:31 +0100
committerRalf Gommers <ralf.gommers@googlemail.com>2013-01-02 20:36:31 +0100
commit9ff6aed1f261706df4e50dc482f004500a98548a (patch)
tree2efefec91a75e6f6ac351fd64a58b9d590ab009c
parentc74586282e4598e70b9b2473ee987785e2a61477 (diff)
downloadpython-numpy-9ff6aed1f261706df4e50dc482f004500a98548a.tar.gz
python-numpy-9ff6aed1f261706df4e50dc482f004500a98548a.tar.bz2
python-numpy-9ff6aed1f261706df4e50dc482f004500a98548a.zip
TST: skip floating point warning test failures on ARM. Closes gh-413.
-rw-r--r--numpy/core/tests/test_errstate.py4
-rw-r--r--numpy/core/tests/test_half.py8
-rw-r--r--numpy/core/tests/test_numeric.py89
-rw-r--r--numpy/core/tests/test_umath_complex.py2
4 files changed, 54 insertions, 49 deletions
diff --git a/numpy/core/tests/test_errstate.py b/numpy/core/tests/test_errstate.py
index a9588463b..526240904 100644
--- a/numpy/core/tests/test_errstate.py
+++ b/numpy/core/tests/test_errstate.py
@@ -8,11 +8,15 @@ import sys
if sys.version_info[:2] >= (2, 5):
exec """
from __future__ import with_statement
+import platform
+
from numpy.core import *
from numpy.random import rand, randint
from numpy.testing import *
+
class TestErrstate(TestCase):
+ @dec.skipif(platform.machine() == "armv5tel", "See gh-413.")
def test_invalid(self):
with errstate(all='raise', under='ignore'):
a = -arange(3)
diff --git a/numpy/core/tests/test_half.py b/numpy/core/tests/test_half.py
index cbb21d4ab..31a206e1c 100644
--- a/numpy/core/tests/test_half.py
+++ b/numpy/core/tests/test_half.py
@@ -1,7 +1,9 @@
-import warnings
+import platform
+
import numpy as np
from numpy import uint16, float16, float32, float64
-from numpy.testing import TestCase, run_module_suite, assert_, assert_equal
+from numpy.testing import TestCase, run_module_suite, assert_, assert_equal, \
+ dec
def assert_raises_fpe(strmatch, callable, *args, **kwargs):
@@ -357,8 +359,8 @@ class TestHalf(TestCase):
assert_equal(np.power(b32,a16).dtype, float16)
assert_equal(np.power(b32,b16).dtype, float32)
+ @dec.skipif(platform.machine() == "armv5tel", "See gh-413.")
def test_half_fpe(self):
- """Test that half raises the correct underflows and overflows"""
oldsettings = np.seterr(all='raise')
try:
sx16 = np.array((1e-4,),dtype=float16)
diff --git a/numpy/core/tests/test_numeric.py b/numpy/core/tests/test_numeric.py
index 480b43811..f9c9cdf52 100644
--- a/numpy/core/tests/test_numeric.py
+++ b/numpy/core/tests/test_numeric.py
@@ -1,13 +1,13 @@
import sys
+import platform
from decimal import Decimal
import numpy as np
from numpy.core import *
from numpy.random import rand, randint, randn
from numpy.testing import *
-from numpy.testing.utils import WarningManager
from numpy.core.multiarray import dot as dot_
-import warnings
+
class Vec(object):
def __init__(self,sequence=None):
@@ -246,6 +246,7 @@ class TestSeterr(TestCase):
finally:
seterr(**err)
+ @dec.skipif(platform.machine() == "armv5tel", "See gh-413.")
def test_divide_err(self):
err = seterr(divide='raise')
try:
@@ -345,7 +346,7 @@ class TestFloatExceptions(TestCase):
class TestTypes(TestCase):
def check_promotion_cases(self, promote_func):
- """Tests that the scalars get coerced correctly."""
+ #Tests that the scalars get coerced correctly.
b = np.bool_(0)
i8, i16, i32, i64 = int8(0), int16(0), int32(0), int64(0)
u8, u16, u32, u64 = uint8(0), uint16(0), uint32(0), uint64(0)
@@ -740,7 +741,7 @@ class TestClip(TestCase):
# Now the real test cases
def test_simple_double(self):
- """Test native double input with scalar min/max."""
+ #Test native double input with scalar min/max.
a = self._generate_data(self.nr, self.nc)
m = 0.1
M = 0.6
@@ -749,7 +750,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_simple_int(self):
- """Test native int input with scalar min/max."""
+ #Test native int input with scalar min/max.
a = self._generate_int_data(self.nr, self.nc)
a = a.astype(int)
m = -2
@@ -759,7 +760,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_array_double(self):
- """Test native double input with array min/max."""
+ #Test native double input with array min/max.
a = self._generate_data(self.nr, self.nc)
m = zeros(a.shape)
M = m + 0.5
@@ -768,8 +769,8 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_simple_nonnative(self):
- """Test non native double input with scalar min/max.
- Test native double input with non native double scalar min/max."""
+ #Test non native double input with scalar min/max.
+ #Test native double input with non native double scalar min/max.
a = self._generate_non_native_data(self.nr, self.nc)
m = -0.5
M = 0.6
@@ -777,7 +778,7 @@ class TestClip(TestCase):
act = self.clip(a, m, M)
assert_array_equal(ac, act)
- "Test native double input with non native double scalar min/max."
+ #Test native double input with non native double scalar min/max.
a = self._generate_data(self.nr, self.nc)
m = -0.5
M = self._neg_byteorder(0.6)
@@ -787,9 +788,8 @@ class TestClip(TestCase):
assert_array_equal(ac, act)
def test_simple_complex(self):
- """Test native complex input with native double scalar min/max.
- Test native input with complex double scalar min/max.
- """
+ #Test native complex input with native double scalar min/max.
+ #Test native input with complex double scalar min/max.
a = 3 * self._generate_data_complex(self.nr, self.nc)
m = -0.5
M = 1.
@@ -797,7 +797,7 @@ class TestClip(TestCase):
act = self.clip(a, m, M)
assert_array_strict_equal(ac, act)
- "Test native input with complex double scalar min/max."
+ #Test native input with complex double scalar min/max.
a = 3 * self._generate_data(self.nr, self.nc)
m = -0.5 + 1.j
M = 1. + 2.j
@@ -806,7 +806,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_clip_non_contig(self):
- """Test clip for non contiguous native input and native scalar min/max."""
+ #Test clip for non contiguous native input and native scalar min/max.
a = self._generate_data(self.nr * 2, self.nc * 3)
a = a[::2, ::3]
assert_(not a.flags['F_CONTIGUOUS'])
@@ -816,7 +816,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_simple_out(self):
- """Test native double input with scalar min/max."""
+ #Test native double input with scalar min/max.
a = self._generate_data(self.nr, self.nc)
m = -0.5
M = 0.6
@@ -827,7 +827,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_simple_int32_inout(self):
- """Test native int32 input with double min/max and int32 out."""
+ #Test native int32 input with double min/max and int32 out.
a = self._generate_int32_data(self.nr, self.nc)
m = float64(0)
M = float64(2)
@@ -838,7 +838,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_simple_int64_out(self):
- """Test native int32 input with int32 scalar min/max and int64 out."""
+ #Test native int32 input with int32 scalar min/max and int64 out.
a = self._generate_int32_data(self.nr, self.nc)
m = int32(-1)
M = int32(1)
@@ -849,7 +849,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_simple_int64_inout(self):
- """Test native int32 input with double array min/max and int32 out."""
+ #Test native int32 input with double array min/max and int32 out.
a = self._generate_int32_data(self.nr, self.nc)
m = zeros(a.shape, float64)
M = float64(1)
@@ -860,7 +860,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_simple_int32_out(self):
- """Test native double input with scalar min/max and int out."""
+ #Test native double input with scalar min/max and int out.
a = self._generate_data(self.nr, self.nc)
m = -1.0
M = 2.0
@@ -871,7 +871,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_simple_inplace_01(self):
- """Test native double input with array min/max in-place."""
+ #Test native double input with array min/max in-place.
a = self._generate_data(self.nr, self.nc)
ac = a.copy()
m = zeros(a.shape)
@@ -881,7 +881,7 @@ class TestClip(TestCase):
assert_array_strict_equal(a, ac)
def test_simple_inplace_02(self):
- """Test native double input with scalar min/max in-place."""
+ #Test native double input with scalar min/max in-place.
a = self._generate_data(self.nr, self.nc)
ac = a.copy()
m = -0.5
@@ -891,7 +891,7 @@ class TestClip(TestCase):
assert_array_strict_equal(a, ac)
def test_noncontig_inplace(self):
- """Test non contiguous double input with double scalar min/max in-place."""
+ #Test non contiguous double input with double scalar min/max in-place.
a = self._generate_data(self.nr * 2, self.nc * 3)
a = a[::2, ::3]
assert_(not a.flags['F_CONTIGUOUS'])
@@ -904,7 +904,7 @@ class TestClip(TestCase):
assert_array_equal(a, ac)
def test_type_cast_01(self):
- "Test native double input with scalar min/max."
+ #Test native double input with scalar min/max.
a = self._generate_data(self.nr, self.nc)
m = -0.5
M = 0.6
@@ -913,7 +913,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_type_cast_02(self):
- "Test native int32 input with int32 scalar min/max."
+ #Test native int32 input with int32 scalar min/max.
a = self._generate_int_data(self.nr, self.nc)
a = a.astype(int32)
m = -2
@@ -923,7 +923,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_type_cast_03(self):
- "Test native int32 input with float64 scalar min/max."
+ #Test native int32 input with float64 scalar min/max.
a = self._generate_int32_data(self.nr, self.nc)
m = -2
M = 4
@@ -932,7 +932,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_type_cast_04(self):
- "Test native int32 input with float32 scalar min/max."
+ #Test native int32 input with float32 scalar min/max.
a = self._generate_int32_data(self.nr, self.nc)
m = float32(-2)
M = float32(4)
@@ -941,7 +941,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_type_cast_05(self):
- "Test native int32 with double arrays min/max."
+ #Test native int32 with double arrays min/max.
a = self._generate_int_data(self.nr, self.nc)
m = -0.5
M = 1.
@@ -950,7 +950,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_type_cast_06(self):
- "Test native with NON native scalar min/max."
+ #Test native with NON native scalar min/max.
a = self._generate_data(self.nr, self.nc)
m = 0.5
m_s = self._neg_byteorder(m)
@@ -960,7 +960,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_type_cast_07(self):
- "Test NON native with native array min/max."
+ #Test NON native with native array min/max.
a = self._generate_data(self.nr, self.nc)
m = -0.5 * ones(a.shape)
M = 1.
@@ -971,7 +971,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_type_cast_08(self):
- "Test NON native with native scalar min/max."
+ #Test NON native with native scalar min/max.
a = self._generate_data(self.nr, self.nc)
m = -0.5
M = 1.
@@ -982,7 +982,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_type_cast_09(self):
- "Test native with NON native array min/max."
+ #Test native with NON native array min/max.
a = self._generate_data(self.nr, self.nc)
m = -0.5 * ones(a.shape)
M = 1.
@@ -993,7 +993,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_type_cast_10(self):
- """Test native int32 with float min/max and float out for output argument."""
+ #Test native int32 with float min/max and float out for output argument.
a = self._generate_int_data(self.nr, self.nc)
b = zeros(a.shape, dtype = float32)
m = float32(-0.5)
@@ -1003,7 +1003,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_type_cast_11(self):
- "Test non native with native scalar, min/max, out non native"
+ #Test non native with native scalar, min/max, out non native
a = self._generate_non_native_data(self.nr, self.nc)
b = a.copy()
b = b.astype(b.dtype.newbyteorder('>'))
@@ -1015,7 +1015,7 @@ class TestClip(TestCase):
assert_array_strict_equal(b, bt)
def test_type_cast_12(self):
- "Test native int32 input and min/max and float out"
+ #Test native int32 input and min/max and float out
a = self._generate_int_data(self.nr, self.nc)
b = zeros(a.shape, dtype = float32)
m = int32(0)
@@ -1025,7 +1025,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_clip_with_out_simple(self):
- "Test native double input with scalar min/max"
+ #Test native double input with scalar min/max
a = self._generate_data(self.nr, self.nc)
m = -0.5
M = 0.6
@@ -1036,7 +1036,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_clip_with_out_simple2(self):
- "Test native int32 input with double min/max and int32 out"
+ #Test native int32 input with double min/max and int32 out
a = self._generate_int32_data(self.nr, self.nc)
m = float64(0)
M = float64(2)
@@ -1047,7 +1047,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_clip_with_out_simple_int32(self):
- "Test native int32 input with int32 scalar min/max and int64 out"
+ #Test native int32 input with int32 scalar min/max and int64 out
a = self._generate_int32_data(self.nr, self.nc)
m = int32(-1)
M = int32(1)
@@ -1058,7 +1058,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_clip_with_out_array_int32(self):
- "Test native int32 input with double array min/max and int32 out"
+ #Test native int32 input with double array min/max and int32 out
a = self._generate_int32_data(self.nr, self.nc)
m = zeros(a.shape, float64)
M = float64(1)
@@ -1069,7 +1069,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_clip_with_out_array_outint32(self):
- "Test native double input with scalar min/max and int out"
+ #Test native double input with scalar min/max and int out
a = self._generate_data(self.nr, self.nc)
m = -1.0
M = 2.0
@@ -1080,7 +1080,7 @@ class TestClip(TestCase):
assert_array_strict_equal(ac, act)
def test_clip_inplace_array(self):
- "Test native double input with array min/max"
+ #Test native double input with array min/max
a = self._generate_data(self.nr, self.nc)
ac = a.copy()
m = zeros(a.shape)
@@ -1090,7 +1090,7 @@ class TestClip(TestCase):
assert_array_strict_equal(a, ac)
def test_clip_inplace_simple(self):
- "Test native double input with scalar min/max"
+ #Test native double input with scalar min/max
a = self._generate_data(self.nr, self.nc)
ac = a.copy()
m = -0.5
@@ -1100,8 +1100,7 @@ class TestClip(TestCase):
assert_array_strict_equal(a, ac)
def test_clip_func_takes_out(self):
- """ Ensure that the clip() function takes an out= argument.
- """
+ # Ensure that the clip() function takes an out= argument.
a = self._generate_data(self.nr, self.nc)
ac = a.copy()
m = -0.5
@@ -1129,7 +1128,7 @@ class TestAllclose(object):
assert_(not allclose(x,y), "%s and %s shouldn't be close" % (x,y))
def test_ip_allclose(self):
- """Parametric test factory."""
+ #Parametric test factory.
arr = array([100,1000])
aran = arange(125).reshape((5,5,5))
@@ -1149,7 +1148,7 @@ class TestAllclose(object):
yield (self.tst_allclose,x,y)
def test_ip_not_allclose(self):
- """Parametric test factory."""
+ #Parametric test factory.
aran = arange(125).reshape((5,5,5))
atol = self.atol
diff --git a/numpy/core/tests/test_umath_complex.py b/numpy/core/tests/test_umath_complex.py
index 76fa29be8..dfc5f2525 100644
--- a/numpy/core/tests/test_umath_complex.py
+++ b/numpy/core/tests/test_umath_complex.py
@@ -151,6 +151,7 @@ class TestClog(TestCase):
assert_almost_equal(y[i], y_r[i])
@platform_skip
+ @dec.skipif(platform.machine() == "armv5tel", "See gh-413.")
def test_special_values(self):
xl = []
yl = []
@@ -477,7 +478,6 @@ class TestCabs(object):
return np.abs(np.complex(a, b))
xa = np.array(x, dtype=np.complex)
- ya = np.array(x, dtype=np.complex)
for i in range(len(xa)):
ref = g(x[i], y[i])
yield check_real_value, f, x[i], y[i], ref