[Scipy-svn] r6216 - branches/0.7.x/scipy/sparse/tests

scipy-svn at scipy.org scipy-svn at scipy.org
Mon Feb 8 04:19:23 EST 2010


Author: cdavid
Date: 2010-02-08 03:19:23 -0600 (Mon, 08 Feb 2010)
New Revision: 6216

Modified:
   branches/0.7.x/scipy/sparse/tests/test_base.py
   branches/0.7.x/scipy/sparse/tests/test_construct.py
Log:
TEST: fix sparse unit tests failures.

With recent changes to numpy test functions, assert_equal(dtype(str),
str) is wrong, so we fix it here.

(cherry picked from commit 8f4a65b53717722d774d6cd06ab0003445909e8c)

Modified: branches/0.7.x/scipy/sparse/tests/test_base.py
===================================================================
--- branches/0.7.x/scipy/sparse/tests/test_base.py	2010-02-07 07:13:04 UTC (rev 6215)
+++ branches/0.7.x/scipy/sparse/tests/test_base.py	2010-02-08 09:19:23 UTC (rev 6216)
@@ -65,7 +65,9 @@
         """Test manipulating empty matrices. Fails in SciPy SVN <= r1768
         """
         shape = (5, 5)
-        for mytype in ['int32', 'float32', 'float64', 'complex64', 'complex128']:
+        for mytype in [np.dtype('int32'), np.dtype('float32'),
+                np.dtype('float64'), np.dtype('complex64'),
+                np.dtype('complex128')]:
             a = self.spmatrix(shape, dtype=mytype)
             b = a + a
             c = 2 * a
@@ -239,11 +241,11 @@
     def test_asfptype(self):
         A = self.spmatrix( arange(6,dtype='int32').reshape(2,3) )
 
-        assert_equal( A.dtype , 'int32' )
-        assert_equal( A.asfptype().dtype, 'float64' )
+        assert_equal( A.dtype , np.dtype('int32') )
+        assert_equal( A.asfptype().dtype, np.dtype('float64') )
         assert_equal( A.asfptype().format, A.format )
-        assert_equal( A.astype('int16').asfptype().dtype , 'float32' )
-        assert_equal( A.astype('complex128').asfptype().dtype , 'complex128' )
+        assert_equal( A.astype('int16').asfptype().dtype , np.dtype('float32') )
+        assert_equal( A.astype('complex128').asfptype().dtype , np.dtype('complex128') )
 
         B = A.asfptype()
         C = B.asfptype()

Modified: branches/0.7.x/scipy/sparse/tests/test_construct.py
===================================================================
--- branches/0.7.x/scipy/sparse/tests/test_construct.py	2010-02-07 07:13:04 UTC (rev 6215)
+++ branches/0.7.x/scipy/sparse/tests/test_construct.py	2010-02-08 09:19:23 UTC (rev 6216)
@@ -67,7 +67,7 @@
         assert_equal(identity(2).toarray(), [[1,0],[0,1]])
 
         I = identity(3, dtype='int8', format='dia')
-        assert_equal( I.dtype, 'int8' )
+        assert_equal( I.dtype, np.dtype('int8') )
         assert_equal( I.format, 'dia' )
 
         for fmt in sparse_formats:
@@ -81,7 +81,7 @@
         assert_equal(eye(3,2).toarray(), [[1,0],[0,1],[0,0]])
         assert_equal(eye(3,3).toarray(), [[1,0,0],[0,1,0],[0,0,1]])
 
-        assert_equal(eye(3,3,dtype='int16').dtype, 'int16')
+        assert_equal(eye(3,3,dtype='int16').dtype, np.dtype('int16'))
 
         for m in [3, 5]:
             for n in [3, 5]:




More information about the Scipy-svn mailing list