[pypy-commit] pypy numpy-ufuncs3: Expose and test left_shift and right_shift

taavi_burns noreply at buildbot.pypy.org
Sun Apr 1 08:32:59 CEST 2012


Author: Taavi Burns <taavi.burns at gmail.com>
Branch: numpy-ufuncs3
Changeset: r54114:24b6c8a2f4ce
Date: 2012-04-01 02:32 -0400
http://bitbucket.org/pypy/pypy/changeset/24b6c8a2f4ce/

Log:	Expose and test left_shift and right_shift

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
@@ -131,6 +131,8 @@
         ('bitwise_or', 'bitwise_or'),
         ('bitwise_xor', 'bitwise_xor'),
         ('bitwise_not', 'invert'),
+        ('left_shift', 'left_shift'),
+        ('right_shift', 'right_shift'),
         ('invert', 'invert'),
         ('isnan', 'isnan'),
         ('isinf', 'isinf'),
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
@@ -597,6 +597,13 @@
         assert (bitwise_not(a) == ~a).all()
         assert (invert(a) == ~a).all()
 
+    def test_shift(self):
+        from _numpypy import left_shift, right_shift
+        import sys
+
+        assert (left_shift([5, 1], [2, 31]) == [20, 2**31]).all()
+        assert (right_shift(10, range(5)) == [10, 5, 2, 1, 0]).all()
+
     def test_comparisons(self):
         import operator
         from _numpypy import equal, not_equal, less, less_equal, greater, greater_equal


More information about the pypy-commit mailing list