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

numpy-svn@scip... numpy-svn@scip...
Thu Jul 10 07:47:30 CDT 2008


Author: alan.mcintyre
Date: 2008-07-10 07:47:28 -0500 (Thu, 10 Jul 2008)
New Revision: 5385

Modified:
   trunk/numpy/core/tests/test_defchararray.py
Log:
Improve chararray __mul__/__rmul__ test so it should fail on 64-bit machines.


Modified: trunk/numpy/core/tests/test_defchararray.py
===================================================================
--- trunk/numpy/core/tests/test_defchararray.py	2008-07-10 11:50:15 UTC (rev 5384)
+++ trunk/numpy/core/tests/test_defchararray.py	2008-07-10 12:47:28 UTC (rev 5385)
@@ -41,10 +41,12 @@
         assert all(QA == ('q' + self.A))
 
     def test_mul(self):
-        A2 = np.array([['abcabc', '123123'],
-                       ['789789', 'xyzxyz']]).view(np.chararray)
+        A = self.A
+        for r in (2,3,5,7,197):
+            Ar = np.array([[A[0,0]*r, A[0,1]*r],
+                           [A[1,0]*r, A[1,1]*r]]).view(np.chararray)
 
-        assert all(A2 == (self.A * 2))
+            assert all(Ar == (self.A * r))
         
         for ob in [object(), 'qrs']:
             try:
@@ -55,10 +57,12 @@
                 self.fail("chararray can only be multiplied by integers")
 
     def test_rmul(self):
-        A2 = np.array([['abcabc', '123123'],
-                       ['789789', 'xyzxyz']]).view(np.chararray)
+        A = self.A
+        for r in (2,3,5,7,197):
+            Ar = np.array([[A[0,0]*r, A[0,1]*r],
+                           [A[1,0]*r, A[1,1]*r]]).view(np.chararray)
 
-        assert all(A2 == (2 * self.A))
+            assert all(Ar == (r * self.A))
         
         for ob in [object(), 'qrs']:
             try:



More information about the Numpy-svn mailing list