[Numpy-svn] r3369 - in trunk/numpy/core: . tests

numpy-svn at scipy.org numpy-svn at scipy.org
Thu Oct 19 12:27:57 CDT 2006


Author: oliphant
Date: 2006-10-19 12:27:55 -0500 (Thu, 19 Oct 2006)
New Revision: 3369

Modified:
   trunk/numpy/core/numeric.py
   trunk/numpy/core/tests/test_ma.py
Log:
Eliminate more warnings in testing.

Modified: trunk/numpy/core/numeric.py
===================================================================
--- trunk/numpy/core/numeric.py	2006-10-19 16:45:36 UTC (rev 3368)
+++ trunk/numpy/core/numeric.py	2006-10-19 17:27:55 UTC (rev 3369)
@@ -781,17 +781,16 @@
     # Note that we don't want to run the above doctests because they will fail
     # without a from __future__ import with_statement
     def __init__(self, **kwargs):
-        try:
-            self.errcall = kwargs.pop('errcall')
-        except KeyError:
-            self.errcall = None
+        self.call = kwargs.pop('call',None)
         self.kwargs = kwargs
     def __enter__(self):
         self.oldstate = seterr(**self.kwargs)
-        self.oldcall = seterrcall(self.errcall)
+        if self.call:
+            self.oldcall = seterrcall(self.call)
     def __exit__(self, *exc_info):
         seterr(**self.oldstate)
-        seterrcall(self.oldcall)
+        if self.call:
+            seterrcall(self.oldcall)
 
 def _setdef():
     defval = [UFUNC_BUFSIZE_DEFAULT, ERR_DEFAULT2, None]

Modified: trunk/numpy/core/tests/test_ma.py
===================================================================
--- trunk/numpy/core/tests/test_ma.py	2006-10-19 16:45:36 UTC (rev 3368)
+++ trunk/numpy/core/tests/test_ma.py	2006-10-19 17:27:55 UTC (rev 3369)
@@ -127,9 +127,9 @@
         self.failUnless (eq(numpy.tanh(x), tanh(xm)))
         olderr = numpy.seterr(divide='ignore', invalid='ignore')
         self.failUnless (eq(numpy.sqrt(abs(x)), sqrt(xm)))
-        numpy.seterr(**olderr)
         self.failUnless (eq(numpy.log(abs(x)), log(xm)))
         self.failUnless (eq(numpy.log10(abs(x)), log10(xm)))
+        numpy.seterr(**olderr)
         self.failUnless (eq(numpy.exp(x), exp(xm)))
         self.failUnless (eq(numpy.arcsin(z), arcsin(zm)))
         self.failUnless (eq(numpy.arccos(z), arccos(zm)))
@@ -680,10 +680,11 @@
             mf = getattr(numpy.ma, f)
             args = self.d[:uf.nin]
             olderr = numpy.geterr()
-            if f in ['sqrt', 'arctanh', 'arcsin', 'arccos', 'arccosh', 'arctanh']:
+            if f in ['sqrt', 'arctanh', 'arcsin', 'arccos', 'arccosh', 'arctanh', 'log',
+                     'log10','divide','true_divide', 'floor_divide', 'remainder', 'fmod']:
                 numpy.seterr(invalid='ignore')
-            if f in ['arctanh']:
-                numpyseterr(divide='ignore']
+            if f in ['arctanh', 'log', 'log10']:
+                numpy.seterr(divide='ignore')
             ur = uf(*args)
             mr = mf(*args)
             numpy.seterr(**olderr)



More information about the Numpy-svn mailing list