Author: mattip <matti.pi...@gmail.com> Branch: numpypy-disable-longdouble Changeset: r61561:20e3e8514b54 Date: 2013-02-14 11:34 +0200 http://bitbucket.org/pypy/pypy/changeset/20e3e8514b54/
Log: fix complex tests diff --git a/pypy/module/micronumpy/test/test_complex.py b/pypy/module/micronumpy/test/test_complex.py --- a/pypy/module/micronumpy/test/test_complex.py +++ b/pypy/module/micronumpy/test/test_complex.py @@ -196,8 +196,13 @@ raises(TypeError, signbit, complex(1,1)) def test_reciprocal(self): - from _numpypy import array, reciprocal, complex64, complex128, clongdouble - + from _numpypy import array, reciprocal, complex64, complex128 + c_and_relerr = [(complex64, 2e-7), (complex128, 2e-15)] + try: + from _numpypy import clongdouble + c_and_relerr.append((clongdouble, 2e-30)) + except: + pass # no longdouble yet inf = float('inf') nan = float('nan') #complex @@ -212,7 +217,7 @@ complex(-r, i), -0j, 0j, cnan, cnan, cnan, cnan] - for c, rel_err in ((complex64, 2e-7), (complex128, 2e-15), (clongdouble, 2e-15)): + for c, rel_err in c_and_relerr: actual = reciprocal(array([orig], dtype=c)) for b, a, e in zip(orig, actual, expected): assert (a[0].real - e.real) < rel_err @@ -232,12 +237,18 @@ raises(TypeError, copysign, a, b) def test_exp2(self): - from _numpypy import array, exp2, complex128, complex64, clongfloat + from _numpypy import array, exp2, complex128, complex64 + c_and_relerr = [(complex64, 2e-7), (complex128, 2e-15)] + try: + from _numpypy import clongdouble + c_and_relerr.append((clongdouble, 2e-30)) + except: + pass # no longdouble yet inf = float('inf') ninf = -float('inf') nan = float('nan') cmpl = complex - for c,rel_err in ((complex128, 2e-15), (complex64, 1e-7), (clongfloat, 2e-15)): + for c,rel_err in c_and_relerr: a = [cmpl(-5., 0), cmpl(-5., -5.), cmpl(-5., 5.), cmpl(0., -5.), cmpl(0., 0.), cmpl(0., 5.), cmpl(-0., -5.), cmpl(-0., 0.), cmpl(-0., 5.), _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit