[Scipy-svn] r6810 - in trunk/scipy/sparse/linalg/dsolve: . tests

scipy-svn@scip... scipy-svn@scip...
Fri Sep 17 08:43:22 CDT 2010


Author: stefan
Date: 2010-09-17 08:43:22 -0500 (Fri, 17 Sep 2010)
New Revision: 6810

Modified:
   trunk/scipy/sparse/linalg/dsolve/linsolve.py
   trunk/scipy/sparse/linalg/dsolve/tests/test_linsolve.py
Log:
BUG: Correct formatting of error message in spsolve.

Modified: trunk/scipy/sparse/linalg/dsolve/linsolve.py
===================================================================
--- trunk/scipy/sparse/linalg/dsolve/linsolve.py	2010-09-16 05:21:48 UTC (rev 6809)
+++ trunk/scipy/sparse/linalg/dsolve/linsolve.py	2010-09-17 13:43:22 UTC (rev 6810)
@@ -62,10 +62,10 @@
 
     M, N = A.shape
     if (M != N):
-        raise ValueError, "matrix must be square (has shape %s)" % (M,N)
+        raise ValueError("matrix must be square (has shape %s)" % ((M, N),))
     if M != b.size:
-        raise ValueError, "matrix - rhs size mismatch (%s - %s)"\
-              % (A.shape, b.size)
+        raise ValueError("matrix - rhs size mismatch (%s - %s)"\
+              % (A.shape, b.size))
 
     use_umfpack = use_umfpack and useUmfpack
 

Modified: trunk/scipy/sparse/linalg/dsolve/tests/test_linsolve.py
===================================================================
--- trunk/scipy/sparse/linalg/dsolve/tests/test_linsolve.py	2010-09-16 05:21:48 UTC (rev 6809)
+++ trunk/scipy/sparse/linalg/dsolve/tests/test_linsolve.py	2010-09-17 13:43:22 UTC (rev 6810)
@@ -51,6 +51,11 @@
 
         assert_array_almost_equal(x, x2)
 
+    def test_non_square(self):
+        A = ones((3, 4))
+        b = ones((4, 1))
+        assert_raises(ValueError, spsolve, A, b)
+
 class TestSplu(object):
     def setUp(self):
         n = 40



More information about the Scipy-svn mailing list