[pypy-commit] pypy default: Export numpy.floor_divide and a basic test

nbm noreply at buildbot.pypy.org
Tue Mar 13 02:21:43 CET 2012


Author: Neil Blakey-Milner <nbm at nxsy.org>
Branch: 
Changeset: r53406:5b3e480bc068
Date: 2012-03-12 18:08 -0700
http://bitbucket.org/pypy/pypy/changeset/5b3e480bc068/

Log:	Export numpy.floor_divide and a basic test

diff --git a/pypy/module/micronumpy/__init__.py b/pypy/module/micronumpy/__init__.py
--- a/pypy/module/micronumpy/__init__.py
+++ b/pypy/module/micronumpy/__init__.py
@@ -115,6 +115,7 @@
         ('log10', 'log10'),
         ('log1p', 'log1p'),
         ('power', 'power'),
+        ('floor_divide', 'floor_divide'),
     ]:
         interpleveldefs[exposed] = "interp_ufuncs.get(space).%s" % impl
 
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
@@ -557,3 +557,10 @@
         c = power(a, b)
         for i in range(len(a)):
             assert c[i] == a[i] ** b[i]
+
+    def test_floordiv(self):
+        from _numpypy import floor_divide, array
+        a = array([1., 2., 3., 4., 5., 6., 6.01])
+        b = floor_divide(a, 2.5)
+        for i in range(len(a)):
+            assert b[i] == a[i] // 2.5


More information about the pypy-commit mailing list