summaryrefslogtreecommitdiff
path: root/numpy/ma/timer_comparison.py
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2020-12-08 13:32:59 -0600
committerSebastian Berg <sebastian@sipsolutions.net>2020-12-08 13:32:59 -0600
commit6f59235f14e8f3f6f5c03d556d2bc7c03ef6e793 (patch)
tree6e5aeb8fec026f7ca6c2ed8f9680edc42e6bbe8a /numpy/ma/timer_comparison.py
parentcb31f35eea66529f51dbc62dde74b3753e676879 (diff)
downloadnumpy-6f59235f14e8f3f6f5c03d556d2bc7c03ef6e793.tar.gz
TST: Do not disable errors globally in ma/timer_comparison.py
This script is meant to be run stand-alone (and should probably just not be at this place), but moving these down is cleaner in any case. The issue is that our "public API" tests import the module and then modify the global state.
Diffstat (limited to 'numpy/ma/timer_comparison.py')
-rw-r--r--numpy/ma/timer_comparison.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/numpy/ma/timer_comparison.py b/numpy/ma/timer_comparison.py
index aff72f79b..9eb1a23cd 100644
--- a/numpy/ma/timer_comparison.py
+++ b/numpy/ma/timer_comparison.py
@@ -7,12 +7,9 @@ import numpy.core.fromnumeric as fromnumeric
from numpy.testing import build_err_msg
-# Fixme: this does not look right.
-np.seterr(all='ignore')
pi = np.pi
-
class ModuleTester:
def __init__(self, module):
self.module = module
@@ -111,6 +108,7 @@ class ModuleTester:
self.assert_array_compare(self.equal, x, y, err_msg=err_msg,
header='Arrays are not equal')
+ @np.errstate(all='ignore')
def test_0(self):
"""
Tests creation
@@ -121,6 +119,7 @@ class ModuleTester:
xm = self.masked_array(x, mask=m)
xm[0]
+ @np.errstate(all='ignore')
def test_1(self):
"""
Tests creation
@@ -148,6 +147,7 @@ class ModuleTester:
xf.shape = s
assert(self.count(xm) == len(m1) - reduce(lambda x, y:x+y, m1))
+ @np.errstate(all='ignore')
def test_2(self):
"""
Tests conversions and indexing.
@@ -190,6 +190,7 @@ class ModuleTester:
m3 = self.make_mask(m, copy=1)
assert(m is not m3)
+ @np.errstate(all='ignore')
def test_3(self):
"""
Tests resize/repeat
@@ -209,6 +210,7 @@ class ModuleTester:
y8 = x4.repeat(2, 0)
assert self.allequal(y5, y8)
+ @np.errstate(all='ignore')
def test_4(self):
"""
Test of take, transpose, inner, outer products.
@@ -232,6 +234,7 @@ class ModuleTester:
assert t[1] == 2
assert t[2] == 3
+ @np.errstate(all='ignore')
def test_5(self):
"""
Tests inplace w/ scalar
@@ -284,6 +287,7 @@ class ModuleTester:
x += 1.
assert self.allequal(x, y + 1.)
+ @np.errstate(all='ignore')
def test_6(self):
"""
Tests inplace w/ array
@@ -335,6 +339,7 @@ class ModuleTester:
x /= a
xm /= a
+ @np.errstate(all='ignore')
def test_7(self):
"Tests ufunc"
d = (self.array([1.0, 0, -1, pi/2]*2, mask=[0, 1]+[0]*6),
@@ -369,6 +374,7 @@ class ModuleTester:
self.assert_array_equal(ur.filled(0), mr.filled(0), f)
self.assert_array_equal(ur._mask, mr._mask)
+ @np.errstate(all='ignore')
def test_99(self):
# test average
ott = self.array([0., 1., 2., 3.], mask=[1, 0, 0, 0])
@@ -414,6 +420,7 @@ class ModuleTester:
self.assert_array_equal(self.average(z, axis=1), [2.5, 5.0])
self.assert_array_equal(self.average(z, axis=0, weights=w2), [0., 1., 99., 99., 4.0, 10.0])
+ @np.errstate(all='ignore')
def test_A(self):
x = self.arange(24)
x[5:6] = self.masked