[Numpy-svn] r5645 - tags/1.2.0b2/numpy/core/tests

numpy-svn@scip... numpy-svn@scip...
Wed Aug 13 17:24:51 CDT 2008


Author: stefan
Date: 2008-08-13 17:24:50 -0500 (Wed, 13 Aug 2008)
New Revision: 5645

Modified:
   tags/1.2.0b2/numpy/core/tests/test_umath.py
Log:
Remove C99 test cases (merged from trunk).


Modified: tags/1.2.0b2/numpy/core/tests/test_umath.py
===================================================================
--- tags/1.2.0b2/numpy/core/tests/test_umath.py	2008-08-13 20:51:02 UTC (rev 5644)
+++ tags/1.2.0b2/numpy/core/tests/test_umath.py	2008-08-13 22:24:50 UTC (rev 5645)
@@ -267,144 +267,6 @@
 
                 assert abs(a - b) < atol, "%s %s: %s; cmath: %s"%(fname,p,a,b)
 
-class TestC99(object):
-    """Check special functions at special points against the C99 standard"""
-    # NB: inherits from object instead of TestCase since using test generators
-
-    #
-    # Non-conforming results are with XXX added to the exception field.
-    #
-
-    def test_clog(self):
-        for p, v, e in [
-            ((-0., 0.), (-inf, pi), 'divide'),
-            ((+0., 0.), (-inf, 0.), 'XXX divide'), # fails on OSX?
-            ((1., inf), (inf, pi/2), ''),
-            ((1., nan), (nan, nan), 'invalid-optional'),
-            ((-inf, 1.), (inf, pi), ''),
-            ((inf, 1.), (inf, 0.), ''),
-            ((-inf, inf), (inf, 3*pi/4), ''),
-            ((inf, inf), (inf, pi/4), ''),
-            ((inf, nan), (inf, nan), ''),
-            ((-inf, nan), (inf, nan), ''),
-            ((nan, 1.), (nan, nan), 'invalid-optional'),
-            ((nan, inf), (inf, nan), ''),
-            ((+nan, nan), (nan, nan), 'XXX'), # raises 'invalid' on some platfs
-        ]:
-            yield self._check, np.log, p, v, e
-
-    def test_csqrt(self):
-        for p, v, e in [
-            ((-0., 0.), (0.,0.),  'XXX'), # now (-0., 0.)
-            ((0., 0.), (0.,0.),  ''),
-            ((1., inf), (inf,inf), 'XXX invalid'), # now (inf, nan)
-            ((nan, inf), (inf,inf), 'XXX'), # now (nan, nan)
-            ((-inf, 1.), (0.,inf), 'XXX'), # (-0., inf) on Mac OSX
-            ((inf, 1.), (inf,0.), ''),
-            ((-inf,nan), (nan, -inf), 'XXX'), # could also be +inf. raises 'invalid' on Sparc64
-            ((inf, nan), (inf, nan),  ''),
-            ((nan, 1.), (nan, nan), 'invalid-optional'),
-            ((nan, nan), (nan, nan), 'XXX'), # raises 'invalid' on Sparc64
-        ]:
-            yield self._check, np.sqrt, p, v, e
-
-    def test_cacos(self):
-        for p, v, e in [
-            ((0., 0.), (pi/2, -0.), 'XXX'), # now (-0., 0.)
-            ((-0., 0.), (pi/2, -0.), ''),
-            ((0., nan), (pi/2, nan), 'XXX'), # now (nan, nan)
-            ((-0., nan), (pi/2, nan), 'XXX'), # now (nan, nan)
-            ((1., inf), (pi/2, -inf), 'XXX'), # now (nan, -inf)
-            ((1., nan), (nan, nan), 'invalid-optional'),
-            ((-inf, 1.), (pi, -inf), 'XXX'), # now (nan, -inf)
-            ((inf, 1.), (0., -inf), 'XXX'), # now (nan, -inf)
-            ((-inf, inf), (3*pi/4, -inf), 'XXX'), # now (nan, nan)
-            ((inf, inf), (pi/4, -inf), 'XXX'), # now (nan, nan)
-            ((inf, nan), (nan, +-inf), 'XXX'), # now (nan, nan)
-            ((-inf, nan), (nan, +-inf), 'XXX'), # now: (nan, nan)
-            ((nan, 1.), (nan, nan), 'invalid-optional'),
-            ((nan, inf), (nan, -inf), 'XXX'), # now: (nan, nan)
-            ((nan, nan), (nan, nan), 'XXX'), # raises 'invalid' on Sparc64
-        ]:
-            yield self._check, np.arccos, p, v, e
-
-    def test_cacosh(self):
-        for p, v, e in [
-            ((0., 0), (0, pi/2), ''),
-            ((-0., 0), (0, pi/2), ''),
-            ((1., inf), (inf, pi/2), 'XXX'), # now: (nan, nan)
-            ((1., nan), (nan, nan), 'invalid-optional'),
-            ((-inf, 1.), (inf, pi), 'XXX'), # now: (inf, nan)
-            ((inf, 1.), (inf, 0.), 'XXX'), # now: (inf, nan)
-            ((-inf, inf), (inf, 3*pi/4), 'XXX'), # now: (nan, nan)
-            ((inf, inf), (inf, pi/4), 'XXX'), # now: (nan, nan)
-            ((inf, nan), (inf, nan), 'XXX'), # now: (nan, nan)
-            ((-inf, nan), (inf, nan), 'XXX'), # now: (nan, nan)
-            ((nan, 1.), (nan, nan), 'invalid-optional'),
-            ((nan, inf), (inf, nan), 'XXX'), # now: (nan, nan)
-            ((nan, nan), (nan, nan), 'XXX') # raises 'invalid' on Sparc64
-        ]:
-            yield self._check, np.arccosh, p, v, e
-
-    def test_casinh(self):
-        for p, v, e in [
-            ((0., 0), (0, 0), ''),
-            ((1., inf), (inf, pi/2), 'XXX'), # now: (inf, nan)
-            ((1., nan), (nan, nan), 'invalid-optional'),
-            ((inf, 1.), (inf, 0.), 'XXX'), # now: (inf, nan)
-            ((inf, inf), (inf, pi/4), 'XXX'), # now: (nan, nan)
-            ((inf, nan), (nan, nan), 'XXX'), # now: (nan, nan)
-            ((nan, 0.), (nan, 0.), 'XXX'), # now: (nan, nan)
-            ((nan, 1.), (nan, nan), 'invalid-optional'),
-            ((nan, inf), (+-inf, nan), 'XXX'), # now: (nan, nan)
-            ((nan, nan), (nan, nan), 'XXX'), # raises 'invalid' on Sparc64
-        ]:
-            yield self._check, np.arcsinh, p, v, e
-
-    def test_catanh(self):
-        for p, v, e in [
-            ((0., 0), (0, 0), ''),
-            ((0., nan), (0., nan), 'XXX'), # now: (nan, nan)
-            ((1., 0.), (inf, 0.), 'XXX divide'), # now: (nan, nan)
-            ((1., inf), (inf, 0.), 'XXX'), # now: (nan, nan)
-            ((1., nan), (nan, nan), 'invalid-optional'),
-            ((inf, 1.), (0., pi/2), 'XXX'), # now: (nan, nan)
-            ((inf, inf), (0, pi/2), 'XXX'), # now: (nan, nan)
-            ((inf, nan), (0, nan), 'XXX'), # now: (nan, nan)
-            ((nan, 1.), (nan, nan), 'invalid-optional'),
-            ((nan, inf), (+0, pi/2), 'XXX'), # now: (nan, nan)
-            ((nan, nan), (nan, nan), 'XXX'), # raises 'invalid' on some platfs
-        ]:
-            yield self._check, np.arctanh, p, v, e
-
-    def _check(self, func, point, value, exc=''):
-        if 'XXX' in exc:
-            raise nose.SkipTest
-        if isinstance(point, tuple): point = complex(*point)
-        if isinstance(value, tuple): value = complex(*value)
-        v = dict(divide='ignore', invalid='ignore',
-                 over='ignore', under='ignore')
-        old_err = np.seterr(**v)
-        try:
-            # check sign of zero, nan, etc.
-            got = complex(func(point))
-            got = "(%s, %s)" % (repr(got.real), repr(got.imag))
-            expected = "(%s, %s)" % (repr(value.real), repr(value.imag))
-            assert got == expected, (got, expected)
-
-            # check exceptions
-            if exc in ('divide', 'invalid', 'over', 'under'):
-                v[exc] = 'raise'
-                np.seterr(**v)
-                assert_raises(FloatingPointError, func, point)
-            else:
-                for k in v.keys(): v[k] = 'raise'
-                if exc == 'invalid-optional': v['invalid'] = 'ignore'
-                np.seterr(**v)
-                func(point)
-        finally:
-            np.seterr(**old_err)
-
 class TestAttributes(TestCase):
     def test_attributes(self):
         add = ncu.add



More information about the Numpy-svn mailing list