summaryrefslogtreecommitdiff
path: root/numpy/testing/utils.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2010-02-21 16:16:40 +0000
committerCharles Harris <charlesr.harris@gmail.com>2010-02-21 16:16:40 +0000
commit0bc06e1d4501f797b9fce40bb55bea2bf1476654 (patch)
treed87a565406455699ca12394b96608c9482829b18 /numpy/testing/utils.py
parent52c43da079009c4b18ec5a7ac6bf31ef6cad69ed (diff)
downloadnumpy-0bc06e1d4501f797b9fce40bb55bea2bf1476654.tar.gz
BUG: More workarounds for np.isinf warning in tests.
Diffstat (limited to 'numpy/testing/utils.py')
-rw-r--r--numpy/testing/utils.py24
1 files changed, 16 insertions, 8 deletions
diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py
index f7fbbc2cb..745398dc3 100644
--- a/numpy/testing/utils.py
+++ b/numpy/testing/utils.py
@@ -61,10 +61,14 @@ def gisfinite(x):
exception is always raised.
This should be removed once this problem is solved at the Ufunc level."""
- from numpy.core import isfinite
- st = isfinite(x)
- if isinstance(st, types.NotImplementedType):
- raise TypeError("isfinite not supported for this type")
+ from numpy.core import isfinite, seterr
+ err = seterr(invalid='ignore')
+ try:
+ st = isfinite(x)
+ if isinstance(st, types.NotImplementedType):
+ raise TypeError("isfinite not supported for this type")
+ finally:
+ seterr(**err)
return st
def gisinf(x):
@@ -78,10 +82,14 @@ def gisinf(x):
exception is always raised.
This should be removed once this problem is solved at the Ufunc level."""
- from numpy.core import isinf
- st = isinf(x)
- if isinstance(st, types.NotImplementedType):
- raise TypeError("isinf not supported for this type")
+ from numpy.core import isinf, seterr
+ err = seterr(invalid='ignore')
+ try:
+ st = isinf(x)
+ if isinstance(st, types.NotImplementedType):
+ raise TypeError("isinf not supported for this type")
+ finally:
+ seterr(**err)
return st
def rand(*args):