[pypy-commit] pypy numpy-ufuncs2: Added a test explicitly for true_divide, to convince myself that it's correct.
taavi_burns
noreply at buildbot.pypy.org
Tue Mar 13 23:16:31 CET 2012
Author: Taavi Burns <taavi.burns at gmail.com>
Branch: numpy-ufuncs2
Changeset: r53497:eee7fba161d6
Date: 2012-03-13 14:37 -0700
http://bitbucket.org/pypy/pypy/changeset/eee7fba161d6/
Log: Added a test explicitly for true_divide, to convince myself that
it's correct.
diff --git a/pypy/module/micronumpy/test/test_ufuncs.py b/pypy/module/micronumpy/test/test_ufuncs.py
--- a/pypy/module/micronumpy/test/test_ufuncs.py
+++ b/pypy/module/micronumpy/test/test_ufuncs.py
@@ -113,6 +113,16 @@
assert (divide(array([-10]), array([2])) == array([-5])).all()
+ def test_true_divide(self):
+ from _numpypy import array, true_divide
+
+ a = array([0, 1, 2, 3, 4, 1, -1])
+ b = array([4, 4, 4, 4, 4, 0, 0])
+ c = true_divide(a, b)
+ assert (c == [0.0, 0.25, 0.5, 0.75, 1.0, float('inf'), float('-inf')]).all()
+
+ assert math.isnan(true_divide(0, 0))
+
def test_fabs(self):
from _numpypy import array, fabs
from math import fabs as math_fabs
More information about the pypy-commit
mailing list