1. Neil Blakey-Milner
  2. pypy

Commits

Neil Blakey-Milner  committed a222998

Export numpy.mod and remainder, add basic tests for them

  • Participants
  • Parent commits 5b3e480
  • Branches default

Comments (0)

Files changed (2)

File pypy/module/micronumpy/__init__.py

View file
  • Ignore whitespace
         ('log1p', 'log1p'),
         ('power', 'power'),
         ('floor_divide', 'floor_divide'),
+        ('mod', 'mod'),
+        ('remainder', 'mod'),
     ]:
         interpleveldefs[exposed] = "interp_ufuncs.get(space).%s" % impl
 

File pypy/module/micronumpy/test/test_ufuncs.py

View file
  • Ignore whitespace
         b = floor_divide(a, 2.5)
         for i in range(len(a)):
             assert b[i] == a[i] // 2.5
+
+    def test_remainder(self):
+        from _numpypy import remainder, array, arange
+        a = arange(7)
+        b = remainder(a, 5)
+        for i in range(len(a)):
+            assert b[i] == a[i] % 5
+
+    def test_mod(self):
+        from _numpypy import mod, array, arange
+        a = arange(7)
+        b = mod(a, 5)
+        for i in range(len(a)):
+            assert b[i] == a[i] % 5