Author: mattip <[email protected]>
Branch: numpypy-complex2
Changeset: r57517:4554f3a57c95
Date: 2012-09-23 22:18 +0200
http://bitbucket.org/pypy/pypy/changeset/4554f3a57c95/

Log:    test log2, fix expected val for exp(complex(inf, inf)) for numpy
        compatability

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
@@ -345,8 +345,19 @@
             assert a[0] == b[0]
             assert a[1] == b[1]
 
+    def test_logn(self):
+        import math
+        # log and log10 are tested in math (1:1 from rcomplex)
+        from _numpypy import log2
+        for v in [float('-nan'), float('-inf'), -1, float('nan')]:
+            assert math.isnan(log2(v))
+        for v in [-0.0, 0.0]:
+            assert log2(v) == float("-inf")
+        assert log2(float('inf')) == float('inf')
+        assert (log2([1, 2.]) == [0, 1]).all()
 
-    def test_complex(self):
+
+    def test_basic(self):
         from _numpypy import (complex128, complex64, add,
             subtract as sub, multiply, divide, negative, abs, fmod, 
             reciprocal)
@@ -414,7 +425,7 @@
                      'log2, log1p, ' + \
                      'logaddexp, npy_log2_1p, logaddexp2'
 
-    def test_complex_math(self):
+    def test_math(self):
         if self.isWindows:
             skip('windows does not support c99 complex')
         import  _numpypy as np
diff --git a/pypy/rlib/test/rcomplex_testcases.txt 
b/pypy/rlib/test/rcomplex_testcases.txt
--- a/pypy/rlib/test/rcomplex_testcases.txt
+++ b/pypy/rlib/test/rcomplex_testcases.txt
@@ -1639,7 +1639,7 @@
 exp1020 exp inf 5.6 -> inf -inf
 exp1021 exp inf 7.0 -> inf inf
 exp1022 exp -inf inf -> 0.0 0.0         ignore-real-sign ignore-imag-sign
-exp1023 exp inf inf -> inf nan          invalid ignore-real-sign
+exp1023 exp inf inf -> nan nan          invalid ignore-real-sign
 exp1024 exp -inf nan -> 0.0 0.0         ignore-real-sign ignore-imag-sign
 exp1025 exp inf nan -> inf nan          ignore-real-sign
 exp1026 exp nan 0.0 -> nan 0.0
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to