[Numpy-svn] r3728 - trunk/numpy/core/tests

numpy-svn@scip... numpy-svn@scip...
Wed Apr 25 04:12:49 CDT 2007


Author: cookedm
Date: 2007-04-25 04:12:45 -0500 (Wed, 25 Apr 2007)
New Revision: 3728

Modified:
   trunk/numpy/core/tests/test_umath.py
Log:
Add test case for integer division


Modified: trunk/numpy/core/tests/test_umath.py
===================================================================
--- trunk/numpy/core/tests/test_umath.py	2007-04-24 21:56:06 UTC (rev 3727)
+++ trunk/numpy/core/tests/test_umath.py	2007-04-25 09:12:45 UTC (rev 3728)
@@ -5,6 +5,14 @@
 from numpy import zeros, ndarray, array, choose
 restore_path()
 
+class test_division(NumpyTestCase):
+    def check_division_int(self):
+        # int division should return the floor of the result, a la Python
+        x = array([5, 10, 90, 100, -5, -10, -90, -100, -120])
+        assert_equal(x / 100, [0, 0, 0, 1, -1, -1, -1, -1, -2])
+        assert_equal(x // 100, [0, 0, 0, 1, -1, -1, -1, -1, -2])
+        assert_equal(x % 100, [5, 10, 90, 0, 95, 90, 10, 0, 80])
+
 class test_power(NumpyTestCase):
     def check_power_float(self):
         x = array([1., 2., 3.])



More information about the Numpy-svn mailing list