[Scipy-svn] r3761 - in branches/testing_cleanup/scipy: . lib/lapack/tests linalg/tests sandbox/exmplpackage/tests sandbox/timeseries sparse sparse/tests

scipy-svn@scip... scipy-svn@scip...
Tue Jan 1 22:07:46 CST 2008


Author: matthew.brett@gmail.com
Date: 2008-01-01 22:07:30 -0600 (Tue, 01 Jan 2008)
New Revision: 3761

Modified:
   branches/testing_cleanup/scipy/__init__.py
   branches/testing_cleanup/scipy/lib/lapack/tests/esv_tests.py
   branches/testing_cleanup/scipy/lib/lapack/tests/gesv_tests.py
   branches/testing_cleanup/scipy/lib/lapack/tests/test_lapack.py
   branches/testing_cleanup/scipy/linalg/tests/test_atlas_version.py
   branches/testing_cleanup/scipy/linalg/tests/test_basic.py
   branches/testing_cleanup/scipy/linalg/tests/test_blas.py
   branches/testing_cleanup/scipy/linalg/tests/test_decomp.py
   branches/testing_cleanup/scipy/linalg/tests/test_fblas.py
   branches/testing_cleanup/scipy/linalg/tests/test_iterative.py
   branches/testing_cleanup/scipy/linalg/tests/test_lapack.py
   branches/testing_cleanup/scipy/linalg/tests/test_matfuncs.py
   branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py
   branches/testing_cleanup/scipy/sandbox/timeseries/dates.py
   branches/testing_cleanup/scipy/sparse/construct.py
   branches/testing_cleanup/scipy/sparse/tests/test_sparse.py
Log:
Slow progress, delayed by a nasty hack in lib.lapack

Modified: branches/testing_cleanup/scipy/__init__.py
===================================================================
--- branches/testing_cleanup/scipy/__init__.py	2008-01-01 22:00:03 UTC (rev 3760)
+++ branches/testing_cleanup/scipy/__init__.py	2008-01-02 04:07:30 UTC (rev 3761)
@@ -14,12 +14,6 @@
 
 """
 
-try:
-    import pkg_resources as _pr # activate namespace packages (manipulates __path__)
-    del _pr
-except ImportError:
-    pass
-
 __all__ = ['pkgload','test']
 
 from numpy import show_config as show_numpy_config

Modified: branches/testing_cleanup/scipy/lib/lapack/tests/esv_tests.py
===================================================================
--- branches/testing_cleanup/scipy/lib/lapack/tests/esv_tests.py	2008-01-01 22:00:03 UTC (rev 3760)
+++ branches/testing_cleanup/scipy/lib/lapack/tests/esv_tests.py	2008-01-02 04:07:30 UTC (rev 3761)
@@ -1,8 +1,8 @@
 
-from numpy.testing import *
-from numpy import *
+from scipy.testing import *
+from numpy import dot
 
-class _test_ev:
+class _test_ev(object):
 
     def check_syev(self,level=1,sym='sy',suffix=''):
         a = [[1,2,3],[2,2,3],[3,3,6]]

Modified: branches/testing_cleanup/scipy/lib/lapack/tests/gesv_tests.py
===================================================================
--- branches/testing_cleanup/scipy/lib/lapack/tests/gesv_tests.py	2008-01-01 22:00:03 UTC (rev 3760)
+++ branches/testing_cleanup/scipy/lib/lapack/tests/gesv_tests.py	2008-01-02 04:07:30 UTC (rev 3761)
@@ -1,8 +1,8 @@
 
-from numpy.testing import *
-from numpy import *
+from scipy.testing import *
+from numpy import dot
 
-class _test_gev:
+class _test_gev(object):
 
     def check_sygv(self,level=1,sym='sy',suffix='',itype=1):
         a = [[1,2,3],[2,2,3],[3,3,6]]

Modified: branches/testing_cleanup/scipy/lib/lapack/tests/test_lapack.py
===================================================================
--- branches/testing_cleanup/scipy/lib/lapack/tests/test_lapack.py	2008-01-01 22:00:03 UTC (rev 3760)
+++ branches/testing_cleanup/scipy/lib/lapack/tests/test_lapack.py	2008-01-02 04:07:30 UTC (rev 3761)
@@ -2,33 +2,36 @@
 #
 # Created by: Pearu Peterson, September 2002
 #
+'''
+This file adapted for nose tests 1/1/08
 
-__usage__ = """
-Build lapack:
-  python setup_lapack.py build
-Run tests if scipy is installed:
-  python -c 'import scipy;scipy.lib.lapack.test(<level>)'
-Run tests if lapack is not installed:
-  python tests/test_lapack.py [<level>]
-"""
+Note that the conversion is not very complete.
 
+This and the included files deliberately use "check_" as the test
+method names.  There are no subclasses of TestCase.  Thus nose will
+pick up nothing but the final test_all_lapack generator function.
+This does the work of collecting the test methods and checking if they
+can be run (see the isrunnable method).  
+'''
+
 import os
 import sys
 from scipy.testing import *
-from numpy import array, ones
+from numpy import dot, ones, zeros
 
-from scipy.lib.lapack import flapack,clapack
+from scipy.lib.lapack import flapack, clapack
 
 sys.path.insert(0, os.path.split(__file__))
 from gesv_tests import _test_gev
 from esv_tests import _test_ev
+del sys.path[0]
 
 #class _test_ev: pass
 
-class _TestLapack(_test_ev,
-                  _test_gev):
-    # Mixin class for lapack tests
-    def test_gebal(self):
+class _TestLapack( _test_ev,
+                   _test_gev):
+
+    def check_gebal(self):
         a = [[1,2,3],[4,5,6],[7,8,9]]
         a1 = [[1,0,0,3e-4],
               [4,0,0,2e-3],
@@ -45,7 +48,7 @@
         ba,lo,hi,pivscale,info = f(a1,permute=1,scale=1)
         assert not info,`info`
 
-    def test_gehrd(self):
+    def check_gehrd(self):
         a = [[-149, -50,-154],
              [ 537, 180, 546],
              [ -27,  -9, -25]]
@@ -54,12 +57,13 @@
         assert not info,`info`
 
     def isrunnable(self,mthname):
+        ''' Return True if required routines for check method present in module '''
         l = mthname.split('_')
         if len(l)>1 and l[0]=='check':
             return hasattr(self.lapack,l[1])
         return 2
 
-class PrefixWrapper:
+class PrefixWrapper(object):
     def __init__(self,module,prefix):
         self.module = module
         self.prefix = prefix
@@ -81,16 +85,16 @@
 ****************************************************************
 """
 else:
-    class TestFlapackDouble(TestCase, _TestLapack):
+    class TestFlapackDouble(_TestLapack):
         lapack = PrefixWrapper(flapack,'d')
         decimal = 12
-    class TestFlapackFloat(TestCase, _TestLapack):
+    class TestFlapackFloat(_TestLapack):
         lapack = PrefixWrapper(flapack,'s')
         decimal = 5
-    class TestFlapackComplex(TestCase, _TestLapack):
+    class TestFlapackComplex(_TestLapack):
         lapack = PrefixWrapper(flapack,'c')
         decimal = 5
-    class TestFlapackDoubleComplex(TestCase, _TestLapack):
+    class TestFlapackDoubleComplex(_TestLapack):
         lapack = PrefixWrapper(flapack,'z')
         decimal = 12
 
@@ -106,18 +110,31 @@
 ****************************************************************
 """
 else:
-    class TestClapackDouble(TestCase, _TestLapack):
+    class TestClapackDouble(_TestLapack):
         lapack = PrefixWrapper(clapack,'d')
         decimal = 12
-    class TestClapackFloat(TestCase, _TestLapack):
+    class TestClapackFloat(_TestLapack):
         lapack = PrefixWrapper(clapack,'s')
         decimal = 5
-    class TestClapackComplex(TestCase, _TestLapack):
+    class TestClapackComplex(_TestLapack):
         lapack = PrefixWrapper(clapack,'c')
         decimal = 5
-    class TestClapackDoubleComplex(TestCase, _TestLapack):
+    class TestClapackDoubleComplex(_TestLapack):
         lapack = PrefixWrapper(clapack,'z')
         decimal = 12
 
-if __name__ == "__main__":
-    unittest.main()
+# Collect test classes and methods with generator
+# This is a moderate hack replicating some obscure numpy testing
+# functionality for use with nose
+
+def test_all_lapack():
+    methods = []
+    for name, value in globals().items():
+        if not (name.startswith('Test')
+                and issubclass(value, _TestLapack)):
+            continue
+        o = value()
+        methods += [getattr(o, n) for n in dir(o) if o.isrunnable(n) is True]
+    for method in methods:
+        yield (method, )
+        

Modified: branches/testing_cleanup/scipy/linalg/tests/test_atlas_version.py
===================================================================
--- branches/testing_cleanup/scipy/linalg/tests/test_atlas_version.py	2008-01-01 22:00:03 UTC (rev 3760)
+++ branches/testing_cleanup/scipy/linalg/tests/test_atlas_version.py	2008-01-02 04:07:30 UTC (rev 3761)
@@ -4,10 +4,10 @@
 #
 
 import sys
-from numpy.testing import *
-set_package_path()
-import linalg.atlas_version
-restore_path()
+from scipy.testing import *
 
+import scipy.linalg.atlas_version
+
+
 # No futher tests possible.
 # Importing atlas_version will print out atlas version.

Modified: branches/testing_cleanup/scipy/linalg/tests/test_basic.py
===================================================================
--- branches/testing_cleanup/scipy/linalg/tests/test_basic.py	2008-01-01 22:00:03 UTC (rev 3760)
+++ branches/testing_cleanup/scipy/linalg/tests/test_basic.py	2008-01-02 04:07:30 UTC (rev 3761)
@@ -23,12 +23,12 @@
 from numpy import arange, add, array, dot, zeros, identity, conjugate, transpose
 
 import sys
-from numpy.testing import *
-set_package_path()
-from linalg import solve,inv,det,lstsq, toeplitz, hankel, tri, triu, tril
-from linalg import pinv, pinv2, solve_banded
-restore_path()
+from scipy.testing import *
 
+from scipy.linalg import solve,inv,det,lstsq, toeplitz, hankel, tri, triu, \
+     tril, pinv, pinv2, solve_banded
+
+
 def random(size):
     return rand(*size)
 
@@ -37,9 +37,9 @@
     data = add.outer(data,data)
     return data
 
-class TestSolveBanded(NumpyTestCase):
+class TestSolveBanded(TestCase):
 
-    def check_simple(self):
+    def test_simple(self):
 
         a = [[1,20,0,0],[-30,4,6,0],[2,1,20,2],[0,-1,7,14]]
         ab = [[0,20,6,2],
@@ -52,9 +52,9 @@
             x = solve_banded((l,u),ab,b)
             assert_array_almost_equal(numpy.dot(a,x),b)
 
-class TestSolve(NumpyTestCase):
+class TestSolve(TestCase):
 
-    def check_20Feb04_bug(self):
+    def test_20Feb04_bug(self):
         a = [[1,1],[1.0,0]] # ok
         x0 = solve(a,[1,0j])
         assert_array_almost_equal(numpy.dot(a,x0),[1,0])
@@ -64,21 +64,21 @@
         x0 = solve(a,b)
         assert_array_almost_equal(numpy.dot(a,x0),[1,0])
 
-    def check_simple(self):
+    def test_simple(self):
         a = [[1,20],[-30,4]]
         for b in ([[1,0],[0,1]],[1,0],
                   [[2,1],[-30,4]]):
             x = solve(a,b)
             assert_array_almost_equal(numpy.dot(a,x),b)
 
-    def check_simple_sym(self):
+    def test_simple_sym(self):
         a = [[2,3],[3,5]]
         for lower in [0,1]:
             for b in ([[1,0],[0,1]],[1,0]):
                 x = solve(a,b,sym_pos=1,lower=lower)
                 assert_array_almost_equal(numpy.dot(a,x),b)
 
-    def check_simple_sym_complex(self):
+    def test_simple_sym_complex(self):
         a = [[5,2],[2,4]]
         for b in [[1j,0],
                   [[1j,1j],
@@ -87,7 +87,7 @@
             x = solve(a,b,sym_pos=1)
             assert_array_almost_equal(numpy.dot(a,x),b)
 
-    def check_simple_complex(self):
+    def test_simple_complex(self):
         a = array([[5,2],[2j,4]],'D')
         for b in [[1j,0],
                   [[1j,1j],
@@ -98,7 +98,7 @@
             x = solve(a,b)
             assert_array_almost_equal(numpy.dot(a,x),b)
 
-    def check_nils_20Feb04(self):
+    def test_nils_20Feb04(self):
         n = 2
         A = random([n,n])+random([n,n])*1j
         X = zeros((n,n),'D')
@@ -109,7 +109,7 @@
             X[:,i] = solve(A,r)
         assert_array_almost_equal(X,Ainv)
 
-    def check_random(self):
+    def test_random(self):
 
         n = 20
         a = random([n,n])
@@ -119,7 +119,7 @@
             x = solve(a,b)
             assert_array_almost_equal(numpy.dot(a,x),b)
 
-    def check_random_complex(self):
+    def test_random_complex(self):
         n = 20
         a = random([n,n]) + 1j * random([n,n])
         for i in range(n): a[i,i] = 20*(.1+a[i,i])
@@ -128,7 +128,7 @@
             x = solve(a,b)
             assert_array_almost_equal(numpy.dot(a,x),b)
 
-    def check_random_sym(self):
+    def test_random_sym(self):
         n = 20
         a = random([n,n])
         for i in range(n):
@@ -140,7 +140,7 @@
             x = solve(a,b,sym_pos=1)
             assert_array_almost_equal(numpy.dot(a,x),b)
 
-    def check_random_sym_complex(self):
+    def test_random_sym_complex(self):
         n = 20
         a = random([n,n])
         #a  = a + 1j*random([n,n]) # XXX: with this the accuracy will be very low
@@ -191,9 +191,9 @@
 
             print '   (secs for %s calls)' % (repeat)
 
-class TestInv(NumpyTestCase):
+class TestInv(TestCase):
 
-    def check_simple(self):
+    def test_simple(self):
         a = [[1,2],[3,4]]
         a_inv = inv(a)
         assert_array_almost_equal(numpy.dot(a,a_inv),
@@ -203,7 +203,7 @@
         assert_array_almost_equal(numpy.dot(a,a_inv),
                                   [[1,0,0],[0,1,0],[0,0,1]])
 
-    def check_random(self):
+    def test_random(self):
         n = 20
         for i in range(4):
             a = random([n,n])
@@ -211,13 +211,13 @@
             a_inv = inv(a)
             assert_array_almost_equal(numpy.dot(a,a_inv),
                                       numpy.identity(n))
-    def check_simple_complex(self):
+    def test_simple_complex(self):
         a = [[1,2],[3,4j]]
         a_inv = inv(a)
         assert_array_almost_equal(numpy.dot(a,a_inv),
                                   [[1,0],[0,1]])
 
-    def check_random_complex(self):
+    def test_random_complex(self):
         n = 20
         for i in range(4):
             a = random([n,n])+2j*random([n,n])
@@ -263,19 +263,19 @@
             print '   (secs for %s calls)' % (repeat)
 
 
-class TestDet(NumpyTestCase):
+class TestDet(TestCase):
 
-    def check_simple(self):
+    def test_simple(self):
         a = [[1,2],[3,4]]
         a_det = det(a)
         assert_almost_equal(a_det,-2.0)
 
-    def check_simple_complex(self):
+    def test_simple_complex(self):
         a = [[1,2],[3,4j]]
         a_det = det(a)
         assert_almost_equal(a_det,-6+4j)
 
-    def check_random(self):
+    def test_random(self):
         import numpy.linalg as linalg
         basic_det = linalg.det
         n = 20
@@ -285,7 +285,7 @@
             d2 = basic_det(a)
             assert_almost_equal(d1,d2)
 
-    def check_random_complex(self):
+    def test_random_complex(self):
         import numpy.linalg as linalg
         basic_det = linalg.det
         n = 20
@@ -338,8 +338,8 @@
     b1 = dot(at, b)
     return solve(a1, b1)
 
-class TestLstsq(NumpyTestCase):
-    def check_random_overdet_large(self):
+class TestLstsq(TestCase):
+    def test_random_overdet_large(self):
         #bug report: Nils Wagner
         n = 200
         a = random([n,2])
@@ -348,21 +348,21 @@
         x = lstsq(a,b)[0]
         assert_array_almost_equal(x,direct_lstsq(a,b))
 
-    def check_simple_exact(self):
+    def test_simple_exact(self):
         a = [[1,20],[-30,4]]
         for b in ([[1,0],[0,1]],[1,0],
                   [[2,1],[-30,4]]):
             x = lstsq(a,b)[0]
             assert_array_almost_equal(numpy.dot(a,x),b)
 
-    def check_simple_overdet(self):
+    def test_simple_overdet(self):
         a = [[1,2],[4,5],[3,4]]
         b = [1,2,3]
         x,res,r,s = lstsq(a,b)
         #XXX: check defintion of res
         assert_array_almost_equal(x,direct_lstsq(a,b))
 
-    def check_simple_underdet(self):
+    def test_simple_underdet(self):
         a = [[1,2,3],[4,5,6]]
         b = [1,2]
         x,res,r,s = lstsq(a,b)
@@ -370,7 +370,7 @@
         assert_array_almost_equal(x,[[-0.05555556],
                                      [0.11111111],[0.27777778]])
 
-    def check_random_exact(self):
+    def test_random_exact(self):
 
         n = 20
         a = random([n,n])
@@ -380,7 +380,7 @@
             x = lstsq(a,b)[0]
             assert_array_almost_equal(numpy.dot(a,x),b)
 
-    def check_random_complex_exact(self):
+    def test_random_complex_exact(self):
         n = 20
         a = random([n,n]) + 1j * random([n,n])
         for i in range(n): a[i,i] = 20*(.1+a[i,i])
@@ -389,7 +389,7 @@
             x = lstsq(a,b)[0]
             assert_array_almost_equal(numpy.dot(a,x),b)
 
-    def check_random_overdet(self):
+    def test_random_overdet(self):
         n = 20
         m = 15
         a = random([n,m])
@@ -401,7 +401,7 @@
             #XXX: check definition of res
             assert_array_almost_equal(x,direct_lstsq(a,b))
 
-    def check_random_complex_overdet(self):
+    def test_random_complex_overdet(self):
         n = 20
         m = 15
         a = random([n,m]) + 1j * random([n,m])
@@ -414,8 +414,8 @@
             #XXX: check definition of res
             assert_array_almost_equal(x,direct_lstsq(a,b,1))
 
-class TestTri(NumpyTestCase):
-    def check_basic(self):
+class TestTri(TestCase):
+    def test_basic(self):
         assert_equal(tri(4),array([[1,0,0,0],
                                    [1,1,0,0],
                                    [1,1,1,0],
@@ -424,7 +424,7 @@
                                                 [1,1,0,0],
                                                 [1,1,1,0],
                                                 [1,1,1,1]],'f'))
-    def check_diag(self):
+    def test_diag(self):
         assert_equal(tri(4,k=1),array([[1,1,0,0],
                                        [1,1,1,0],
                                        [1,1,1,1],
@@ -433,7 +433,7 @@
                                         [1,0,0,0],
                                         [1,1,0,0],
                                         [1,1,1,0]]))
-    def check_2d(self):
+    def test_2d(self):
         assert_equal(tri(4,3),array([[1,0,0],
                                      [1,1,0],
                                      [1,1,1],
@@ -441,7 +441,7 @@
         assert_equal(tri(3,4),array([[1,0,0,0],
                                      [1,1,0,0],
                                      [1,1,1,0]]))
-    def check_diag2d(self):
+    def test_diag2d(self):
         assert_equal(tri(3,4,k=2),array([[1,1,1,0],
                                          [1,1,1,1],
                                          [1,1,1,1]]))
@@ -450,8 +450,8 @@
                                           [1,0,0],
                                           [1,1,0]]))
 
-class TestTril(NumpyTestCase):
-    def check_basic(self):
+class TestTril(TestCase):
+    def test_basic(self):
         a = (100*get_mat(5)).astype('l')
         b = a.copy()
         for k in range(5):
@@ -459,7 +459,7 @@
                 b[k,l] = 0
         assert_equal(tril(a),b)
 
-    def check_diag(self):
+    def test_diag(self):
         a = (100*get_mat(5)).astype('f')
         b = a.copy()
         for k in range(5):
@@ -472,8 +472,8 @@
                 b[k,l] = 0
         assert_equal(tril(a,k=-2),b)
 
-class TestTriu(NumpyTestCase):
-    def check_basic(self):
+class TestTriu(TestCase):
+    def test_basic(self):
         a = (100*get_mat(5)).astype('l')
         b = a.copy()
         for k in range(5):
@@ -481,7 +481,7 @@
                 b[l,k] = 0
         assert_equal(triu(a),b)
 
-    def check_diag(self):
+    def test_diag(self):
         a = (100*get_mat(5)).astype('f')
         b = a.copy()
         for k in range(5):
@@ -494,46 +494,46 @@
                 b[l,k] = 0
         assert_equal(triu(a,k=-2),b)
 
-class TestToeplitz(NumpyTestCase):
-    def check_basic(self):
+class TestToeplitz(TestCase):
+    def test_basic(self):
         y = toeplitz([1,2,3])
         assert_array_equal(y,[[1,2,3],[2,1,2],[3,2,1]])
         y = toeplitz([1,2,3],[1,4,5])
         assert_array_equal(y,[[1,4,5],[2,1,4],[3,2,1]])
 
-class TestHankel(NumpyTestCase):
-    def check_basic(self):
+class TestHankel(TestCase):
+    def test_basic(self):
         y = hankel([1,2,3])
         assert_array_equal(y,[[1,2,3],[2,3,0],[3,0,0]])
         y = hankel([1,2,3],[3,4,5])
         assert_array_equal(y,[[1,2,3],[2,3,4],[3,4,5]])
 
-class TestPinv(NumpyTestCase):
+class TestPinv(TestCase):
 
-    def check_simple(self):
+    def test_simple(self):
         a=array([[1,2,3],[4,5,6.],[7,8,10]])
         a_pinv = pinv(a)
         assert_array_almost_equal(dot(a,a_pinv),[[1,0,0],[0,1,0],[0,0,1]])
         a_pinv = pinv2(a)
         assert_array_almost_equal(dot(a,a_pinv),[[1,0,0],[0,1,0],[0,0,1]])
 
-    def check_simple_0det(self):
+    def test_simple_0det(self):
         a=array([[1,2,3],[4,5,6.],[7,8,9]])
         a_pinv = pinv(a)
         a_pinv2 = pinv2(a)
         assert_array_almost_equal(a_pinv,a_pinv2)
 
-    def check_simple_cols(self):
+    def test_simple_cols(self):
         a=array([[1,2,3],[4,5,6.]])
         a_pinv = pinv(a)
         a_pinv2 = pinv2(a)
         assert_array_almost_equal(a_pinv,a_pinv2)
 
-    def check_simple_rows(self):
+    def test_simple_rows(self):
         a=array([[1,2],[3,4],[5,6]])
         a_pinv = pinv(a)
         a_pinv2 = pinv2(a)
         assert_array_almost_equal(a_pinv,a_pinv2)
 
 if __name__ == "__main__":
-    NumpyTest().run()
+    unittest.main()

Modified: branches/testing_cleanup/scipy/linalg/tests/test_blas.py
===================================================================
--- branches/testing_cleanup/scipy/linalg/tests/test_blas.py	2008-01-01 22:00:03 UTC (rev 3760)
+++ branches/testing_cleanup/scipy/linalg/tests/test_blas.py	2008-01-02 04:07:30 UTC (rev 3761)
@@ -12,21 +12,19 @@
   python tests/test_blas.py [<level>]
 """
 
+import sys
+import math
 
 from numpy import arange, add, array
-import math
 
-import sys
-from numpy.testing import *
-set_package_path()
-from linalg import fblas
-print fblas
-from linalg import cblas
-restore_path()
+from scipy.testing import *
 
-class TestCBLAS1Simple(NumpyTestCase):
+from scipy.linalg import fblas, cblas
 
-    def check_axpy(self):
+
+class TestCBLAS1Simple(TestCase):
+
+    def test_axpy(self):
         for p in 'sd':
             f = getattr(cblas,p+'axpy',None)
             if f is None: continue
@@ -36,9 +34,9 @@
             if f is None: continue
             assert_array_almost_equal(f(5,[1,2j,3],[2,-1,3]),[7,10j-1,18])
 
-class TestFBLAS1Simple(NumpyTestCase):
+class TestFBLAS1Simple(TestCase):
 
-    def check_axpy(self):
+    def test_axpy(self):
         for p in 'sd':
             f = getattr(fblas,p+'axpy',None)
             if f is None: continue
@@ -47,7 +45,7 @@
             f = getattr(fblas,p+'axpy',None)
             if f is None: continue
             assert_array_almost_equal(f([1,2j,3],[2,-1,3],a=5),[7,10j-1,18])
-    def check_copy(self):
+    def test_copy(self):
         for p in 'sd':
             f = getattr(fblas,p+'copy',None)
             if f is None: continue
@@ -56,7 +54,7 @@
             f = getattr(fblas,p+'copy',None)
             if f is None: continue
             assert_array_almost_equal(f([3,4j,5+3j],[8]*3),[3,4j,5+3j])
-    def check_asum(self):
+    def test_asum(self):
         for p in 'sd':
             f = getattr(fblas,p+'asum',None)
             if f is None: continue
@@ -65,24 +63,24 @@
             f = getattr(fblas,p+'asum',None)
             if f is None: continue
             assert_almost_equal(f([3j,-4,3-4j]),14)
-    def check_dot(self):
+    def test_dot(self):
         for p in 'sd':
             f = getattr(fblas,p+'dot',None)
             if f is None: continue
             assert_almost_equal(f([3,-4,5],[2,5,1]),-9)
-    def check_complex_dotu(self):
+    def test_complex_dotu(self):
         for p in 'cz':
             f = getattr(fblas,p+'dotu',None)
             if f is None: continue
             assert_almost_equal(f([3j,-4,3-4j],[2,3,1]),-9+2j)
 
-    def check_complex_dotc(self):
+    def test_complex_dotc(self):
         for p in 'cz':
             f = getattr(fblas,p+'dotc',None)
             if f is None: continue
             assert_almost_equal(f([3j,-4,3-4j],[2,3j,1]),3-14j)
 
-    def check_nrm2(self):
+    def test_nrm2(self):
         for p in 'sd':
             f = getattr(fblas,p+'nrm2',None)
             if f is None: continue
@@ -91,7 +89,7 @@
             f = getattr(fblas,p+'nrm2',None)
             if f is None: continue
             assert_almost_equal(f([3j,-4,3-4j]),math.sqrt(50))
-    def check_scal(self):
+    def test_scal(self):
         for p in 'sd':
             f = getattr(fblas,p+'scal',None)
             if f is None: continue
@@ -104,7 +102,7 @@
             f = getattr(fblas,p+'scal',None)
             if f is None: continue
             assert_array_almost_equal(f(3,[3j,-4,3-4j]),[9j,-12,9-12j])
-    def check_swap(self):
+    def test_swap(self):
         for p in 'sd':
             f = getattr(fblas,p+'swap',None)
             if f is None: continue
@@ -119,7 +117,7 @@
             x1,y1 = f(x,y)
             assert_array_almost_equal(x1,y)
             assert_array_almost_equal(y1,x)
-    def check_amax(self):
+    def test_amax(self):
         for p in 'sd':
             f = getattr(fblas,'i'+p+'amax')
             assert_equal(f([-2,4,3]),1)
@@ -128,9 +126,9 @@
             assert_equal(f([-5,4+3j,6]),1)
     #XXX: need tests for rot,rotm,rotg,rotmg
 
-class TestFBLAS2Simple(NumpyTestCase):
+class TestFBLAS2Simple(TestCase):
 
-    def check_gemv(self):
+    def test_gemv(self):
         for p in 'sd':
             f = getattr(fblas,p+'gemv',None)
             if f is None: continue
@@ -142,7 +140,7 @@
             assert_array_almost_equal(f(3j,[[3-4j]],[-4]),[-48-36j])
             assert_array_almost_equal(f(3j,[[3-4j]],[-4],3,[5j]),[-48-21j])
 
-    def check_ger(self):
+    def test_ger(self):
 
         for p in 'sd':
             f = getattr(fblas,p+'ger',None)
@@ -176,9 +174,9 @@
                                            2j,
                                            3j],[3j,4j]),[[6,8],[12,16],[18,24]])
 
-class TestFBLAS3Simple(NumpyTestCase):
+class TestFBLAS3Simple(TestCase):
 
-    def check_gemm(self):
+    def test_gemm(self):
         for p in 'sd':
             f = getattr(fblas,p+'gemm',None)
             if f is None: continue
@@ -190,9 +188,9 @@
             assert_array_almost_equal(f(3j,[3-4j],[-4]),[[-48-36j]])
             assert_array_almost_equal(f(3j,[3-4j],[-4],3,[5j]),[-48-21j])
 
-class TestBLAS(NumpyTestCase):
+class TestBLAS(TestCase):
 
-    def check_fblas(self):
+    def test_fblas(self):
         if hasattr(fblas,'empty_module'):
             print """
 ****************************************************************
@@ -201,7 +199,7 @@
 See scipy/INSTALL.txt for troubleshooting.
 ****************************************************************
 """
-    def check_cblas(self):
+    def test_cblas(self):
         if hasattr(cblas,'empty_module'):
             print """
 ****************************************************************
@@ -215,4 +213,4 @@
 """
 
 if __name__ == "__main__":
-    NumpyTest().run()
+    unittest.main()

Modified: branches/testing_cleanup/scipy/linalg/tests/test_decomp.py
===================================================================
--- branches/testing_cleanup/scipy/linalg/tests/test_decomp.py	2008-01-01 22:00:03 UTC (rev 3760)
+++ branches/testing_cleanup/scipy/linalg/tests/test_decomp.py	2008-01-02 04:07:30 UTC (rev 3761)
@@ -15,31 +15,35 @@
 """
 
 import sys
-from numpy.testing import *
+from scipy.testing import *
 
-set_package_path()
-from linalg import eig,eigvals,lu,svd,svdvals,cholesky,qr,schur,rsf2csf
-from linalg import lu_solve,lu_factor,solve,diagsvd,hessenberg,rq
-from linalg import eig_banded,eigvals_banded
-from linalg.flapack import dgbtrf, dgbtrs, zgbtrf, zgbtrs
-from linalg.flapack import dsbev, dsbevd, dsbevx, zhbevd, zhbevx
-restore_path()
 
-from numpy import *
+from scipy.linalg import eig,eigvals,lu,svd,svdvals,cholesky,qr, \
+     schur,rsf2csf, lu_solve,lu_factor,solve,diagsvd,hessenberg,rq, \
+     eig_banded, eigvals_banded
+from scipy.linalg.flapack import dgbtrf, dgbtrs, zgbtrf, zgbtrs, \
+     dsbev, dsbevd, dsbevx, zhbevd, zhbevx
+
+from numpy import array, transpose, sometrue, diag, ones, linalg, \
+     argsort, zeros, arange, float32, complex64, dot, conj, identity, \
+     ravel, sqrt, iscomplex, shape, sort, sign, conjugate, sign, bmat, \
+     asarray, matrix, isfinite
+
+
 from numpy.random import rand
 
 def random(size):
     return rand(*size)
 
-class TestEigVals(NumpyTestCase):
+class TestEigVals(TestCase):
 
-    def check_simple(self):
+    def test_simple(self):
         a = [[1,2,3],[1,2,3],[2,5,6]]
         w = eigvals(a)
         exact_w = [(9+sqrt(93))/2,0,(9-sqrt(93))/2]
         assert_array_almost_equal(w,exact_w)
 
-    def check_simple_tr(self):
+    def test_simple_tr(self):
         a = array([[1,2,3],[1,2,3],[2,5,6]],'d')
         a = transpose(a).copy()
         a = transpose(a)
@@ -47,7 +51,7 @@
         exact_w = [(9+sqrt(93))/2,0,(9-sqrt(93))/2]
         assert_array_almost_equal(w,exact_w)
 
-    def check_simple_complex(self):
+    def test_simple_complex(self):
         a = [[1,2,3],[1,2,3],[2,5,6+1j]]
         w = eigvals(a)
         exact_w = [(9+1j+sqrt(92+6j))/2,
@@ -77,9 +81,9 @@
 
             print '   (secs for %s calls)' % (repeat)
 
-class TestEig(NumpyTestCase):
+class TestEig(TestCase):
 
-    def check_simple(self):
+    def test_simple(self):
         a = [[1,2,3],[1,2,3],[2,5,6]]
         w,v = eig(a)
         exact_w = [(9+sqrt(93))/2,0,(9-sqrt(93))/2]
@@ -99,7 +103,7 @@
         for i in range(3):
             assert_array_almost_equal(dot(transpose(a),v[:,i]),w[i]*v[:,i])
 
-    def check_simple_complex(self):
+    def test_simple_complex(self):
         a = [[1,2,3],[1,2,3],[2,5,6+1j]]
         w,vl,vr = eig(a,left=1,right=1)
         for i in range(3):
@@ -151,10 +155,10 @@
             if all(isfinite(res[:, i])):
                 assert_array_almost_equal(res[:, i], 0)
 
-class TestEigBanded(NumpyTestCase):
+class TestEigBanded(TestCase):
 
     def __init__(self, *args):
-        NumpyTestCase.__init__(self, *args)
+        TestCase.__init__(self, *args)
 
         self.create_bandmat()
 
@@ -238,7 +242,7 @@
     #####################################################################
 
 
-    def check_dsbev(self):
+    def test_dsbev(self):
         """Compare dsbev eigenvalues and eigenvectors with
            the result of linalg.eig."""
         w, evec, info  = dsbev(self.bandmat_sym, compute_v=1)
@@ -248,7 +252,7 @@
 
 
 
-    def check_dsbevd(self):
+    def test_dsbevd(self):
         """Compare dsbevd eigenvalues and eigenvectors with
            the result of linalg.eig."""
         w, evec, info = dsbevd(self.bandmat_sym, compute_v=1)
@@ -258,7 +262,7 @@
 
 
 
-    def check_dsbevx(self):
+    def test_dsbevx(self):
         """Compare dsbevx eigenvalues and eigenvectors
            with the result of linalg.eig."""
         N,N = shape(self.sym_mat)
@@ -270,7 +274,7 @@
         assert_array_almost_equal(abs(evec_), abs(self.evec_sym_lin))
 
 
-    def check_zhbevd(self):
+    def test_zhbevd(self):
         """Compare zhbevd eigenvalues and eigenvectors
            with the result of linalg.eig."""
         w, evec, info = zhbevd(self.bandmat_herm, compute_v=1)
@@ -280,7 +284,7 @@
 
 
 
-    def check_zhbevx(self):
+    def test_zhbevx(self):
         """Compare zhbevx eigenvalues and eigenvectors
            with the result of linalg.eig."""
         N,N = shape(self.herm_mat)
@@ -293,7 +297,7 @@
 
 
 
-    def check_eigvals_banded(self):
+    def test_eigvals_banded(self):
         """Compare eigenvalues of eigvals_banded with those of linalg.eig."""
         w_sym = eigvals_banded(self.bandmat_sym)
         w_sym = w_sym.real
@@ -332,7 +336,7 @@
 
 
 
-    def check_eig_banded(self):
+    def test_eig_banded(self):
         """Compare eigenvalues and eigenvectors of eig_banded
            with those of linalg.eig. """
         w_sym, evec_sym = eig_banded(self.bandmat_sym)
@@ -382,7 +386,7 @@
                                   abs(self.evec_herm_lin[:,ind1:ind2+1]) )
 
 
-    def check_dgbtrf(self):
+    def test_dgbtrf(self):
         """Compare dgbtrf  LU factorisation with the LU factorisation result
            of linalg.lu."""
         M,N = shape(self.real_mat)
@@ -397,7 +401,7 @@
         assert_array_almost_equal(u, u_lin)
 
 
-    def check_zgbtrf(self):
+    def test_zgbtrf(self):
         """Compare zgbtrf  LU factorisation with the LU factorisation result
            of linalg.lu."""
         M,N = shape(self.comp_mat)
@@ -413,7 +417,7 @@
 
 
 
-    def check_dgbtrs(self):
+    def test_dgbtrs(self):
         """Compare dgbtrs  solutions for linear equation system  A*x = b
            with solutions of linalg.solve."""
 
@@ -423,7 +427,7 @@
         y_lin = linalg.solve(self.real_mat, self.b)
         assert_array_almost_equal(y, y_lin)
 
-    def check_zgbtrs(self):
+    def test_zgbtrs(self):
         """Compare zgbtrs  solutions for linear equation system  A*x = b
            with solutions of linalg.solve."""
 
@@ -436,10 +440,10 @@
 
 
 
-class TestLU(NumpyTestCase):
+class TestLU(TestCase):
 
     def __init__(self, *args, **kw):
-        NumpyTestCase.__init__(self, *args, **kw)
+        TestCase.__init__(self, *args, **kw)
 
         self.a = array([[1,2,3],[1,2,3],[2,5,6]])
         self.ca = array([[1,2,3],[1,2,3],[2,5j,6]])
@@ -466,37 +470,37 @@
         assert_array_almost_equal(dot(pl,u),data)
 
     # Simple tests
-    def check_simple(self):
+    def test_simple(self):
         self._test_common(self.a)
 
-    def check_simple_complex(self):
+    def test_simple_complex(self):
         self._test_common(self.ca)
 
-    def check_simple2(self):
+    def test_simple2(self):
         self._test_common(self.b)
 
-    def check_simple2_complex(self):
+    def test_simple2_complex(self):
         self._test_common(self.cb)
 
     # rectangular matrices tests
-    def check_hrectangular(self):
+    def test_hrectangular(self):
         self._test_common(self.hrect)
 
-    def check_vrectangular(self):
+    def test_vrectangular(self):
         self._test_common(self.vrect)
 
-    def check_hrectangular_complex(self):
+    def test_hrectangular_complex(self):
         self._test_common(self.chrect)
 
-    def check_vrectangular_complex(self):
+    def test_vrectangular_complex(self):
         self._test_common(self.cvrect)
 
     # Bigger matrices
-    def check_medium1(self, level = 2):
+    def test_medium1(self):
         """Check lu decomposition on medium size, rectangular matrix."""
         self._test_common(self.med)
 
-    def check_medium1_complex(self, level = 2):
+    def test_medium1_complex(self):
         """Check lu decomposition on medium size, rectangular matrix."""
         self._test_common(self.cmed)
 
@@ -519,8 +523,8 @@
         self.med = self.vrect.astype(float32)
         self.cmed = self.vrect.astype(complex64)
 
-class TestLUSolve(NumpyTestCase):
-    def check_lu(self):
+class TestLUSolve(TestCase):
+    def test_lu(self):
         a = random((10,10))
         b = random((10,))
 
@@ -531,9 +535,9 @@
 
         assert_array_equal(x1,x2)
 
-class TestSVD(NumpyTestCase):
+class TestSVD(TestCase):
 
-    def check_simple(self):
+    def test_simple(self):
         a = [[1,2,3],[1,20,3],[2,5,6]]
         u,s,vh = svd(a)
         assert_array_almost_equal(dot(transpose(u),u),identity(3))
@@ -542,7 +546,7 @@
         for i in range(len(s)): sigma[i,i] = s[i]
         assert_array_almost_equal(dot(dot(u,sigma),vh),a)
 
-    def check_simple_singular(self):
+    def test_simple_singular(self):
         a = [[1,2,3],[1,2,3],[2,5,6]]
         u,s,vh = svd(a)
         assert_array_almost_equal(dot(transpose(u),u),identity(3))
@@ -551,7 +555,7 @@
         for i in range(len(s)): sigma[i,i] = s[i]
         assert_array_almost_equal(dot(dot(u,sigma),vh),a)
 
-    def check_simple_underdet(self):
+    def test_simple_underdet(self):
         a = [[1,2,3],[4,5,6]]
         u,s,vh = svd(a)
         assert_array_almost_equal(dot(transpose(u),u),identity(2))
@@ -560,7 +564,7 @@
         for i in range(len(s)): sigma[i,i] = s[i]
         assert_array_almost_equal(dot(dot(u,sigma),vh),a)
 
-    def check_simple_overdet(self):
+    def test_simple_overdet(self):
         a = [[1,2],[4,5],[3,4]]
         u,s,vh = svd(a)
         assert_array_almost_equal(dot(transpose(u),u),identity(3))
@@ -569,7 +573,7 @@
         for i in range(len(s)): sigma[i,i] = s[i]
         assert_array_almost_equal(dot(dot(u,sigma),vh),a)
 
-    def check_random(self):
+    def test_random(self):
         n = 20
         m = 15
         for i in range(3):
@@ -581,7 +585,7 @@
                 for i in range(len(s)): sigma[i,i] = s[i]
                 assert_array_almost_equal(dot(dot(u,sigma),vh),a)
 
-    def check_simple_complex(self):
+    def test_simple_complex(self):
         a = [[1,2,3],[1,2j,3],[2,5,6]]
         u,s,vh = svd(a)
         assert_array_almost_equal(dot(conj(transpose(u)),u),identity(3))
@@ -590,7 +594,7 @@
         for i in range(len(s)): sigma[i,i] = s[i]
         assert_array_almost_equal(dot(dot(u,sigma),vh),a)
 
-    def check_random_complex(self):
+    def test_random_complex(self):
         n = 20
         m = 15
         for i in range(3):
@@ -604,52 +608,52 @@
                 for i in range(len(s)): sigma[i,i] = s[i]
                 assert_array_almost_equal(dot(dot(u,sigma),vh),a)
 
-class TestSVDVals(NumpyTestCase):
+class TestSVDVals(TestCase):
 
-    def check_simple(self):
+    def test_simple(self):
         a = [[1,2,3],[1,2,3],[2,5,6]]
         s = svdvals(a)
         assert len(s)==3
         assert s[0]>=s[1]>=s[2]
 
-    def check_simple_underdet(self):
+    def test_simple_underdet(self):
         a = [[1,2,3],[4,5,6]]
         s = svdvals(a)
         assert len(s)==2
         assert s[0]>=s[1]
 
-    def check_simple_overdet(self):
+    def test_simple_overdet(self):
         a = [[1,2],[4,5],[3,4]]
         s = svdvals(a)
         assert len(s)==2
         assert s[0]>=s[1]
 
-    def check_simple_complex(self):
+    def test_simple_complex(self):
         a = [[1,2,3],[1,20,3j],[2,5,6]]
         s = svdvals(a)
         assert len(s)==3
         assert s[0]>=s[1]>=s[2]
 
-    def check_simple_underdet_complex(self):
+    def test_simple_underdet_complex(self):
         a = [[1,2,3],[4,5j,6]]
         s = svdvals(a)
         assert len(s)==2
         assert s[0]>=s[1]
 
-    def check_simple_overdet_complex(self):
+    def test_simple_overdet_complex(self):
         a = [[1,2],[4,5],[3j,4]]
         s = svdvals(a)
         assert len(s)==2
         assert s[0]>=s[1]
 
-class TestDiagSVD(NumpyTestCase):
+class TestDiagSVD(TestCase):
 
-    def check_simple(self):
+    def test_simple(self):
         assert_array_almost_equal(diagsvd([1,0,0],3,3),[[1,0,0],[0,0,0],[0,0,0]])
 
-class TestCholesky(NumpyTestCase):
+class TestCholesky(TestCase):
 
-    def check_simple(self):
+    def test_simple(self):
         a = [[8,2,3],[2,9,3],[3,3,6]]
         c = cholesky(a)
         assert_array_almost_equal(dot(transpose(c),c),a)
@@ -657,7 +661,7 @@
         a = dot(c,transpose(c))
         assert_array_almost_equal(cholesky(a,lower=1),c)
 
-    def check_simple_complex(self):
+    def test_simple_complex(self):
         m = array([[3+1j,3+4j,5],[0,2+2j,2+7j],[0,0,7+4j]])
         a = dot(transpose(conjugate(m)),m)
         c = cholesky(a)
@@ -667,7 +671,7 @@
         a = dot(c,transpose(conjugate(c)))
         assert_array_almost_equal(cholesky(a,lower=1),c)
 
-    def check_random(self):
+    def test_random(self):
         n = 20
         for k in range(2):
             m = random([n,n])
@@ -681,7 +685,7 @@
             a = dot(c,transpose(c))
             assert_array_almost_equal(cholesky(a,lower=1),c)
 
-    def check_random_complex(self):
+    def test_random_complex(self):
         n = 20
         for k in range(2):
             m = random([n,n])+1j*random([n,n])
@@ -696,28 +700,28 @@
             assert_array_almost_equal(cholesky(a,lower=1),c)
 
 
-class TestQR(NumpyTestCase):
+class TestQR(TestCase):
 
-    def check_simple(self):
+    def test_simple(self):
         a = [[8,2,3],[2,9,3],[5,3,6]]
         q,r = qr(a)
         assert_array_almost_equal(dot(transpose(q),q),identity(3))
         assert_array_almost_equal(dot(q,r),a)
 
-    def check_simple_trap(self):
+    def test_simple_trap(self):
         a = [[8,2,3],[2,9,3]]
         q,r = qr(a)
         assert_array_almost_equal(dot(transpose(q),q),identity(2))
         assert_array_almost_equal(dot(q,r),a)
 
-    def check_simple_tall(self):
+    def test_simple_tall(self):
         # full version
         a = [[8,2],[2,9],[5,3]]
         q,r = qr(a)
         assert_array_almost_equal(dot(transpose(q),q),identity(3))
         assert_array_almost_equal(dot(q,r),a)
 
-    def check_simple_tall_e(self):
+    def test_simple_tall_e(self):
         # economy version
         a = [[8,2],[2,9],[5,3]]
         q,r = qr(a,econ=True)
@@ -726,13 +730,13 @@
         assert_equal(q.shape, (3,2))
         assert_equal(r.shape, (2,2))
 
-    def check_simple_complex(self):
+    def test_simple_complex(self):
         a = [[3,3+4j,5],[5,2,2+7j],[3,2,7]]
         q,r = qr(a)
         assert_array_almost_equal(dot(conj(transpose(q)),q),identity(3))
         assert_array_almost_equal(dot(q,r),a)
 
-    def check_random(self):
+    def test_random(self):
         n = 20
         for k in range(2):
             a = random([n,n])
@@ -740,7 +744,7 @@
             assert_array_almost_equal(dot(transpose(q),q),identity(n))
             assert_array_almost_equal(dot(q,r),a)
 
-    def check_random_tall(self):
+    def test_random_tall(self):
         # full version
         m = 200
         n = 100
@@ -750,7 +754,7 @@
             assert_array_almost_equal(dot(transpose(q),q),identity(m))
             assert_array_almost_equal(dot(q,r),a)
 
-    def check_random_tall_e(self):
+    def test_random_tall_e(self):
         # economy version
         m = 200
         n = 100
@@ -762,7 +766,7 @@
             assert_equal(q.shape, (m,n))
             assert_equal(r.shape, (n,n))
 
-    def check_random_trap(self):
+    def test_random_trap(self):
         m = 100
         n = 200
         for k in range(2):
@@ -771,7 +775,7 @@
             assert_array_almost_equal(dot(transpose(q),q),identity(m))
             assert_array_almost_equal(dot(q,r),a)
 
-    def check_random_complex(self):
+    def test_random_complex(self):
         n = 20
         for k in range(2):
             a = random([n,n])+1j*random([n,n])
@@ -779,15 +783,15 @@
             assert_array_almost_equal(dot(conj(transpose(q)),q),identity(n))
             assert_array_almost_equal(dot(q,r),a)
 
-class TestRQ(NumpyTestCase):
+class TestRQ(TestCase):
 
-    def check_simple(self):
+    def test_simple(self):
         a = [[8,2,3],[2,9,3],[5,3,6]]
         r,q = rq(a)
         assert_array_almost_equal(dot(transpose(q),q),identity(3))
         assert_array_almost_equal(dot(r,q),a)
 
-    def check_random(self):
+    def test_random(self):
         n = 20
         for k in range(2):
             a = random([n,n])
@@ -797,25 +801,25 @@
 
 # TODO: implement support for non-square and complex arrays
 
-##    def check_simple_trap(self):
+##    def test_simple_trap(self):
 ##        a = [[8,2,3],[2,9,3]]
 ##        r,q = rq(a)
 ##        assert_array_almost_equal(dot(transpose(q),q),identity(2))
 ##        assert_array_almost_equal(dot(r,q),a)
 
-##    def check_simple_tall(self):
+##    def test_simple_tall(self):
 ##        a = [[8,2],[2,9],[5,3]]
 ##        r,q = rq(a)
 ##        assert_array_almost_equal(dot(transpose(q),q),identity(3))
 ##        assert_array_almost_equal(dot(r,q),a)
 
-##    def check_simple_complex(self):
+##    def test_simple_complex(self):
 ##        a = [[3,3+4j,5],[5,2,2+7j],[3,2,7]]
 ##        r,q = rq(a)
 ##        assert_array_almost_equal(dot(conj(transpose(q)),q),identity(3))
 ##        assert_array_almost_equal(dot(r,q),a)
 
-##    def check_random_tall(self):
+##    def test_random_tall(self):
 ##        m = 200
 ##        n = 100
 ##        for k in range(2):
@@ -824,7 +828,7 @@
 ##            assert_array_almost_equal(dot(transpose(q),q),identity(m))
 ##            assert_array_almost_equal(dot(r,q),a)
 
-##    def check_random_trap(self):
+##    def test_random_trap(self):
 ##        m = 100
 ##        n = 200
 ##        for k in range(2):
@@ -833,7 +837,7 @@
 ##            assert_array_almost_equal(dot(transpose(q),q),identity(m))
 ##            assert_array_almost_equal(dot(r,q),a)
 
-##    def check_random_complex(self):
+##    def test_random_complex(self):
 ##        n = 20
 ##        for k in range(2):
 ##            a = random([n,n])+1j*random([n,n])
@@ -844,9 +848,9 @@
 transp = transpose
 any = sometrue
 
-class TestSchur(NumpyTestCase):
+class TestSchur(TestCase):
 
-    def check_simple(self):
+    def test_simple(self):
         a = [[8,12,3],[2,9,3],[10,3,6]]
         t,z = schur(a)
         assert_array_almost_equal(dot(dot(z,t),transp(conj(z))),a)
@@ -856,9 +860,9 @@
         tc2,zc2 = rsf2csf(tc,zc)
         assert_array_almost_equal(dot(dot(zc2,tc2),transp(conj(zc2))),a)
 
-class TestHessenberg(NumpyTestCase):
+class TestHessenberg(TestCase):
 
-    def check_simple(self):
+    def test_simple(self):
         a = [[-149, -50,-154],
              [ 537, 180, 546],
              [ -27,  -9, -25]]
@@ -869,7 +873,7 @@
         assert_array_almost_equal(dot(transp(q),dot(a,q)),h)
         assert_array_almost_equal(h,h1,decimal=4)
 
-    def check_simple_complex(self):
+    def test_simple_complex(self):
         a = [[-149, -50,-154],
              [ 537, 180j, 546],
              [ -27j,  -9, -25]]
@@ -877,7 +881,7 @@
         h1 = dot(transp(conj(q)),dot(a,q))
         assert_array_almost_equal(h1,h)
 
-    def check_simple2(self):
+    def test_simple2(self):
         a = [[1,2,3,4,5,6,7],
              [0,2,3,4,6,7,2],
              [0,2,2,3,0,3,2],
@@ -888,14 +892,14 @@
         h,q = hessenberg(a,calc_q=1)
         assert_array_almost_equal(dot(transp(q),dot(a,q)),h)
 
-    def check_random(self):
+    def test_random(self):
         n = 20
         for k in range(2):
             a = random([n,n])
             h,q = hessenberg(a,calc_q=1)
             assert_array_almost_equal(dot(transp(q),dot(a,q)),h)
 
-    def check_random_complex(self):
+    def test_random_complex(self):
         n = 20
         for k in range(2):
             a = random([n,n])+1j*random([n,n])
@@ -905,9 +909,9 @@
 
 
 
-class TestDataNotShared(NumpyTestCase):
+class TestDataNotShared(TestCase):
 
-    def check_datanotshared(self):
+    def test_datanotshared(self):
         from scipy.linalg.decomp import _datanotshared
 
         M = matrix([[0,1],[2,3]])
@@ -924,4 +928,4 @@
 
 
 if __name__ == "__main__":
-    NumpyTest().run()
+    unittest.main()

Modified: branches/testing_cleanup/scipy/linalg/tests/test_fblas.py
===================================================================
--- branches/testing_cleanup/scipy/linalg/tests/test_fblas.py	2008-01-01 22:00:03 UTC (rev 3760)
+++ branches/testing_cleanup/scipy/linalg/tests/test_fblas.py	2008-01-02 04:07:30 UTC (rev 3761)
@@ -6,14 +6,16 @@
 # !! Complex calculations really aren't checked that carefully.
 # !! Only real valued complex numbers are used in tests.
 
-from numpy import *
-
 import sys
-from numpy.testing import *
-set_package_path()
-from linalg import fblas
-restore_path()
 
+from numpy import dot, float32, float64, complex64, complex128, \
+     arange, array, zeros, shape, transpose, newaxis, \
+     common_type, conjugate
+from scipy.linalg import fblas
+
+from scipy.testing import *
+
+
 #decimal accuracy to require between Python and LAPACK/BLAS calculations
 accuracy = 5
 
@@ -40,39 +42,40 @@
 ##################################################
 ### Test blas ?axpy
 
-class BaseAxpy(NumpyTestCase):
-    def check_default_a(self):
+class BaseAxpy(object):
+    ''' Mixin class for axpy tests '''
+    def test_default_a(self):
         x = arange(3.,dtype=self.dtype)
         y = arange(3.,dtype=x.dtype)
         real_y = x*1.+y
         self.blas_func(x,y)
         assert_array_equal(real_y,y)
-    def check_simple(self):
+    def test_simple(self):
         x = arange(3.,dtype=self.dtype)
         y = arange(3.,dtype=x.dtype)
         real_y = x*3.+y
         self.blas_func(x,y,a=3.)
         assert_array_equal(real_y,y)
-    def check_x_stride(self):
+    def test_x_stride(self):
         x = arange(6.,dtype=self.dtype)
         y = zeros(3,x.dtype)
         y = arange(3.,dtype=x.dtype)
         real_y = x[::2]*3.+y
         self.blas_func(x,y,a=3.,n=3,incx=2)
         assert_array_equal(real_y,y)
-    def check_y_stride(self):
+    def test_y_stride(self):
         x = arange(3.,dtype=self.dtype)
         y = zeros(6,x.dtype)
         real_y = x*3.+y[::2]
         self.blas_func(x,y,a=3.,n=3,incy=2)
         assert_array_equal(real_y,y[::2])
-    def check_x_and_y_stride(self):
+    def test_x_and_y_stride(self):
         x = arange(12.,dtype=self.dtype)
         y = zeros(6,x.dtype)
         real_y = x[::4]*3.+y[::2]
         self.blas_func(x,y,a=3.,n=3,incx=4,incy=2)
         assert_array_equal(real_y,y[::2])
-    def check_x_bad_size(self):
+    def test_x_bad_size(self):
         x = arange(12.,dtype=self.dtype)
         y = zeros(6,x.dtype)
         try:
@@ -81,7 +84,7 @@
             return
         # should catch error and never get here
         assert(0)
-    def check_y_bad_size(self):
+    def test_y_bad_size(self):
         x = arange(12.,dtype=complex64)
         y = zeros(6,x.dtype)
         try:
@@ -92,21 +95,21 @@
         assert(0)
 
 try:
-    class TestSaxpy(BaseAxpy):
+    class TestSaxpy(TestCase, BaseAxpy):
         blas_func = fblas.saxpy
         dtype = float32
 except AttributeError:
     class TestSaxpy: pass
-class TestDaxpy(BaseAxpy):
+class TestDaxpy(TestCase, BaseAxpy):
     blas_func = fblas.daxpy
     dtype = float64
 try:
-    class TestCaxpy(BaseAxpy):
+    class TestCaxpy(TestCase, BaseAxpy):
         blas_func = fblas.caxpy
         dtype = complex64
 except AttributeError:
     class TestCaxpy: pass
-class TestZaxpy(BaseAxpy):
+class TestZaxpy(TestCase, BaseAxpy):
     blas_func = fblas.zaxpy
     dtype = complex128
 
@@ -114,19 +117,20 @@
 ##################################################
 ### Test blas ?scal
 
-class BaseScal(NumpyTestCase):
-    def check_simple(self):
+class BaseScal(object):
+    ''' Mixin class for scal testing '''
+    def test_simple(self):
         x = arange(3.,dtype=self.dtype)
         real_x = x*3.
         self.blas_func(3.,x)
         assert_array_equal(real_x,x)
-    def check_x_stride(self):
+    def test_x_stride(self):
         x = arange(6.,dtype=self.dtype)
         real_x = x.copy()
         real_x[::2] = x[::2]*array(3.,self.dtype)
         self.blas_func(3.,x,n=3,incx=2)
         assert_array_equal(real_x,x)
-    def check_x_bad_size(self):
+    def test_x_bad_size(self):
         x = arange(12.,dtype=self.dtype)
         try:
             self.blas_func(2.,x,n=4,incx=5)
@@ -135,21 +139,21 @@
         # should catch error and never get here
         assert(0)
 try:
-    class TestSscal(BaseScal):
+    class TestSscal(TestCase, BaseScal):
         blas_func = fblas.sscal
         dtype = float32
 except AttributeError:
     class TestSscal: pass
-class TestDscal(BaseScal):
+class TestDscal(TestCase, BaseScal):
     blas_func = fblas.dscal
     dtype = float64
 try:
-    class TestCscal(BaseScal):
+    class TestCscal(TestCase, BaseScal):
         blas_func = fblas.cscal
         dtype = complex64
 except AttributeError:
     class TestCscal: pass
-class TestZscal(BaseScal):
+class TestZscal(TestCase, BaseScal):
     blas_func = fblas.zscal
     dtype = complex128
 
@@ -159,28 +163,29 @@
 ##################################################
 ### Test blas ?copy
 
-class BaseCopy(NumpyTestCase):
-    def check_simple(self):
+class BaseCopy(object):
+    ''' Mixin class for copy testing '''
+    def test_simple(self):
         x = arange(3.,dtype=self.dtype)
         y = zeros(shape(x),x.dtype)
         self.blas_func(x,y)
         assert_array_equal(x,y)
-    def check_x_stride(self):
+    def test_x_stride(self):
         x = arange(6.,dtype=self.dtype)
         y = zeros(3,x.dtype)
         self.blas_func(x,y,n=3,incx=2)
         assert_array_equal(x[::2],y)
-    def check_y_stride(self):
+    def test_y_stride(self):
         x = arange(3.,dtype=self.dtype)
         y = zeros(6,x.dtype)
         self.blas_func(x,y,n=3,incy=2)
         assert_array_equal(x,y[::2])
-    def check_x_and_y_stride(self):
+    def test_x_and_y_stride(self):
         x = arange(12.,dtype=self.dtype)
         y = zeros(6,x.dtype)
         self.blas_func(x,y,n=3,incx=4,incy=2)
         assert_array_equal(x[::4],y[::2])
-    def check_x_bad_size(self):
+    def test_x_bad_size(self):
         x = arange(12.,dtype=self.dtype)
         y = zeros(6,x.dtype)
         try:
@@ -189,7 +194,7 @@
             return
         # should catch error and never get here
         assert(0)
-    def check_y_bad_size(self):
+    def test_y_bad_size(self):
         x = arange(12.,dtype=complex64)
         y = zeros(6,x.dtype)
         try:
@@ -198,7 +203,7 @@
             return
         # should catch error and never get here
         assert(0)
-    #def check_y_bad_type(self):
+    #def test_y_bad_type(self):
     ##   Hmmm. Should this work?  What should be the output.
     #    x = arange(3.,dtype=self.dtype)
     #    y = zeros(shape(x))
@@ -206,21 +211,21 @@
     #    assert_array_equal(x,y)
 
 try:
-    class TestScopy(BaseCopy):
+    class TestScopy(TestCase, BaseCopy):
         blas_func = fblas.scopy
         dtype = float32
 except AttributeError:
     class TestScopy: pass
-class TestDcopy(BaseCopy):
+class TestDcopy(TestCase, BaseCopy):
     blas_func = fblas.dcopy
     dtype = float64
 try:
-    class TestCcopy(BaseCopy):
+    class TestCcopy(TestCase, BaseCopy):
         blas_func = fblas.ccopy
         dtype = complex64
 except AttributeError:
     class TestCcopy: pass
-class TestZcopy(BaseCopy):
+class TestZcopy(TestCase, BaseCopy):
     blas_func = fblas.zcopy
     dtype = complex128
 
@@ -228,8 +233,9 @@
 ##################################################
 ### Test blas ?swap
 
-class BaseSwap(NumpyTestCase):
-    def check_simple(self):
+class BaseSwap(object):
+    ''' Mixin class for swap tests '''
+    def test_simple(self):
         x = arange(3.,dtype=self.dtype)
         y = zeros(shape(x),x.dtype)
         desired_x = y.copy()
@@ -237,7 +243,7 @@
         self.blas_func(x,y)
         assert_array_equal(desired_x,x)
         assert_array_equal(desired_y,y)
-    def check_x_stride(self):
+    def test_x_stride(self):
         x = arange(6.,dtype=self.dtype)
         y = zeros(3,x.dtype)
         desired_x = y.copy()
@@ -245,7 +251,7 @@
         self.blas_func(x,y,n=3,incx=2)
         assert_array_equal(desired_x,x[::2])
         assert_array_equal(desired_y,y)
-    def check_y_stride(self):
+    def test_y_stride(self):
         x = arange(3.,dtype=self.dtype)
         y = zeros(6,x.dtype)
         desired_x = y.copy()[::2]
@@ -254,7 +260,7 @@
         assert_array_equal(desired_x,x)
         assert_array_equal(desired_y,y[::2])
 
-    def check_x_and_y_stride(self):
+    def test_x_and_y_stride(self):
         x = arange(12.,dtype=self.dtype)
         y = zeros(6,x.dtype)
         desired_x = y.copy()[::2]
@@ -262,7 +268,7 @@
         self.blas_func(x,y,n=3,incx=4,incy=2)
         assert_array_equal(desired_x,x[::4])
         assert_array_equal(desired_y,y[::2])
-    def check_x_bad_size(self):
+    def test_x_bad_size(self):
         x = arange(12.,dtype=self.dtype)
         y = zeros(6,x.dtype)
         try:
@@ -271,7 +277,7 @@
             return
         # should catch error and never get here
         assert(0)
-    def check_y_bad_size(self):
+    def test_y_bad_size(self):
         x = arange(12.,dtype=complex64)
         y = zeros(6,x.dtype)
         try:
@@ -282,21 +288,21 @@
         assert(0)
 
 try:
-    class TestSswap(BaseSwap):
+    class TestSswap(TestCase, BaseSwap):
         blas_func = fblas.sswap
         dtype = float32
 except AttributeError:
     class TestSswap: pass
-class TestDswap(BaseSwap):
+class TestDswap(TestCase, BaseSwap):
     blas_func = fblas.dswap
     dtype = float64
 try:
-    class TestCswap(BaseSwap):
+    class TestCswap(TestCase, BaseSwap):
         blas_func = fblas.cswap
         dtype = complex64
 except AttributeError:
     class TestCswap: pass
-class TestZswap(BaseSwap):
+class TestZswap(TestCase, BaseSwap):
     blas_func = fblas.zswap
     dtype = complex128
 
@@ -304,7 +310,8 @@
 ### Test blas ?gemv
 ### This will be a mess to test all cases.
 
-class BaseGemv(NumpyTestCase):
+class BaseGemv(object):
+    ''' Mixin class for gemv tests '''
     def get_data(self,x_stride=1,y_stride=1):
         mult = array(1, dtype = self.dtype)
         if self.dtype in [complex64, complex128]:
@@ -316,37 +323,37 @@
         x = arange(shape(a)[0]*x_stride,dtype=self.dtype) * mult
         y = arange(shape(a)[1]*y_stride,dtype=self.dtype) * mult
         return alpha,beta,a,x,y
-    def check_simple(self):
+    def test_simple(self):
         alpha,beta,a,x,y = self.get_data()
         desired_y = alpha*matrixmultiply(a,x)+beta*y
         y = self.blas_func(alpha,a,x,beta,y)
         assert_array_almost_equal(desired_y,y)
-    def check_default_beta_y(self):
+    def test_default_beta_y(self):
         alpha,beta,a,x,y = self.get_data()
         desired_y = matrixmultiply(a,x)
         y = self.blas_func(1,a,x)
         assert_array_almost_equal(desired_y,y)
-    def check_simple_transpose(self):
+    def test_simple_transpose(self):
         alpha,beta,a,x,y = self.get_data()
         desired_y = alpha*matrixmultiply(transpose(a),x)+beta*y
         y = self.blas_func(alpha,a,x,beta,y,trans=1)
         assert_array_almost_equal(desired_y,y)
-    def check_simple_transpose_conj(self):
+    def test_simple_transpose_conj(self):
         alpha,beta,a,x,y = self.get_data()
         desired_y = alpha*matrixmultiply(transpose(conjugate(a)),x)+beta*y
         y = self.blas_func(alpha,a,x,beta,y,trans=2)
         assert_array_almost_equal(desired_y,y)
-    def check_x_stride(self):
+    def test_x_stride(self):
         alpha,beta,a,x,y = self.get_data(x_stride=2)
         desired_y = alpha*matrixmultiply(a,x[::2])+beta*y
         y = self.blas_func(alpha,a,x,beta,y,incx=2)
         assert_array_almost_equal(desired_y,y)
-    def check_x_stride_transpose(self):
+    def test_x_stride_transpose(self):
         alpha,beta,a,x,y = self.get_data(x_stride=2)
         desired_y = alpha*matrixmultiply(transpose(a),x[::2])+beta*y
         y = self.blas_func(alpha,a,x,beta,y,trans=1,incx=2)
         assert_array_almost_equal(desired_y,y)
-    def check_x_stride_assert(self):
+    def test_x_stride_assert(self):
         # What is the use of this test?
         alpha,beta,a,x,y = self.get_data(x_stride=2)
         try:
@@ -359,19 +366,19 @@
             assert(0)
         except:
             pass
-    def check_y_stride(self):
+    def test_y_stride(self):
         alpha,beta,a,x,y = self.get_data(y_stride=2)
         desired_y = y.copy()
         desired_y[::2] = alpha*matrixmultiply(a,x)+beta*y[::2]
         y = self.blas_func(alpha,a,x,beta,y,incy=2)
         assert_array_almost_equal(desired_y,y)
-    def check_y_stride_transpose(self):
+    def test_y_stride_transpose(self):
         alpha,beta,a,x,y = self.get_data(y_stride=2)
         desired_y = y.copy()
         desired_y[::2] = alpha*matrixmultiply(transpose(a),x)+beta*y[::2]
         y = self.blas_func(alpha,a,x,beta,y,trans=1,incy=2)
         assert_array_almost_equal(desired_y,y)
-    def check_y_stride_assert(self):
+    def test_y_stride_assert(self):
         # What is the use of this test?
         alpha,beta,a,x,y = self.get_data(y_stride=2)
         try:
@@ -386,21 +393,21 @@
             pass
 
 try:
-    class TestSgemv(BaseGemv):
+    class TestSgemv(TestCase, BaseGemv):
         blas_func = fblas.sgemv
         dtype = float32
 except AttributeError:
     class TestSgemv: pass
-class TestDgemv(BaseGemv):
+class TestDgemv(TestCase, BaseGemv):
     blas_func = fblas.dgemv
     dtype = float64
 try:
-    class TestCgemv(BaseGemv):
+    class TestCgemv(TestCase, BaseGemv):
         blas_func = fblas.cgemv
         dtype = complex64
 except AttributeError:
     class TestCgemv: pass
-class TestZgemv(BaseGemv):
+class TestZgemv(TestCase, BaseGemv):
     blas_func = fblas.zgemv
     dtype = complex128
 
@@ -409,7 +416,7 @@
 ### Test blas ?ger
 ### This will be a mess to test all cases.
 
-class BaseGer(NumpyTestCase):
+class BaseGer(TestCase):
     def get_data(self,x_stride=1,y_stride=1):
         from numpy.random import normal
         alpha = array(1., dtype = self.dtype)
@@ -417,31 +424,31 @@
         x = arange(shape(a)[0]*x_stride,dtype=self.dtype)
         y = arange(shape(a)[1]*y_stride,dtype=self.dtype)
         return alpha,a,x,y
-    def check_simple(self):
+    def test_simple(self):
         alpha,a,x,y = self.get_data()
         # tranpose takes care of Fortran vs. C(and Python) memory layout
         desired_a = alpha*transpose(x[:,newaxis]*y) + a
         self.blas_func(x,y,a)
         assert_array_almost_equal(desired_a,a)
-    def check_x_stride(self):
+    def test_x_stride(self):
         alpha,a,x,y = self.get_data(x_stride=2)
         desired_a = alpha*transpose(x[::2,newaxis]*y) + a
         self.blas_func(x,y,a,incx=2)
         assert_array_almost_equal(desired_a,a)
-    def check_x_stride_assert(self):
+    def test_x_stride_assert(self):
         alpha,a,x,y = self.get_data(x_stride=2)
         try:
             self.blas_func(x,y,a,incx=3)
             assert(0)
         except:
             pass
-    def check_y_stride(self):
+    def test_y_stride(self):
         alpha,a,x,y = self.get_data(y_stride=2)
         desired_a = alpha*transpose(x[:,newaxis]*y[::2]) + a
         self.blas_func(x,y,a,incy=2)
         assert_array_almost_equal(desired_a,a)
 
-    def check_y_stride_assert(self):
+    def test_y_stride_assert(self):
         alpha,a,x,y = self.get_data(y_stride=2)
         try:
             self.blas_func(a,x,y,incy=3)
@@ -472,7 +479,7 @@
         y = normal(0.,1.,shape(a)[1]*y_stride).astype(self.dtype)
         y = y + y * array(1j, dtype = self.dtype)
         return alpha,a,x,y
-    def check_simple(self):
+    def test_simple(self):
         alpha,a,x,y = self.get_data()
         # tranpose takes care of Fortran vs. C(and Python) memory layout
         a = a * array(0.,dtype = self.dtype)
@@ -482,12 +489,12 @@
         fblas.cgeru(x,y,a,alpha = alpha)
         assert_array_almost_equal(desired_a,a)
 
-    #def check_x_stride(self):
+    #def test_x_stride(self):
     #    alpha,a,x,y = self.get_data(x_stride=2)
     #    desired_a = alpha*transpose(x[::2,newaxis]*self.transform(y)) + a
     #    self.blas_func(x,y,a,incx=2)
     #    assert_array_almost_equal(desired_a,a)
-    #def check_y_stride(self):
+    #def test_y_stride(self):
     #    alpha,a,x,y = self.get_data(y_stride=2)
     #    desired_a = alpha*transpose(x[:,newaxis]*self.transform(y[::2])) + a
     #    self.blas_func(x,y,a,incy=2)
@@ -518,4 +525,4 @@
 """
 
 if __name__ == "__main__":
-    NumpyTest().run()
+    unittest.main()

Modified: branches/testing_cleanup/scipy/linalg/tests/test_iterative.py
===================================================================
--- branches/testing_cleanup/scipy/linalg/tests/test_iterative.py	2008-01-01 22:00:03 UTC (rev 3760)
+++ branches/testing_cleanup/scipy/linalg/tests/test_iterative.py	2008-01-02 04:07:30 UTC (rev 3761)
@@ -13,15 +13,14 @@
   python tests/test_iterative.py [<level>]
 """
 
+import sys
+
 from numpy import zeros, dot, diag, ones
-from numpy.testing import *
+from scipy.testing import *
 from numpy.random import rand
 #from numpy import arange, add, array, dot, zeros, identity, conjugate, transpose
 
-import sys
-set_package_path()
-from linalg import iterative, norm, cg, cgs, bicg, bicgstab, gmres, qmr
-restore_path()
+from scipy.linalg import iterative, norm, cg, cgs, bicg, bicgstab, gmres, qmr
 
 
 def callback(x):
@@ -29,9 +28,9 @@
     res = b-dot(A,x)
     #print "||A.x - b|| = " + str(norm(dot(A,x)-b))
 
-class TestIterativeSolvers(NumpyTestCase):
+class TestIterativeSolvers(TestCase):
     def __init__(self, *args, **kwds):
-        NumpyTestCase.__init__(self, *args, **kwds)
+        TestCase.__init__(self, *args, **kwds)
         self.setUp()
     def setUp (self):
         global A, b
@@ -44,41 +43,41 @@
         self.b = rand(n)
         b = self.b
 
-    def check_cg(self):
+    def test_cg(self):
         bx0 = self.x0.copy()
         x, info = cg(self.A, self.b, self.x0, callback=callback)
         assert_array_equal(bx0, self.x0)
         assert norm(dot(self.A, x) - self.b) < 5*self.tol
 
-    def check_bicg(self):
+    def test_bicg(self):
         bx0 = self.x0.copy()
         x, info = bicg(self.A, self.b, self.x0, callback=callback)
         assert_array_equal(bx0, self.x0)
         assert norm(dot(self.A, x) - self.b) < 5*self.tol
 
-    def check_cgs(self):
+    def test_cgs(self):
         bx0 = self.x0.copy()
         x, info = cgs(self.A, self.b, self.x0, callback=callback)
         assert_array_equal(bx0, self.x0)
         assert norm(dot(self.A, x) - self.b) < 5*self.tol
 
-    def check_bicgstab(self):
+    def test_bicgstab(self):
         bx0 = self.x0.copy()
         x, info = bicgstab(self.A, self.b, self.x0, callback=callback)
         assert_array_equal(bx0, self.x0)
         assert norm(dot(self.A, x) - self.b) < 5*self.tol
 
-    def check_gmres(self):
+    def test_gmres(self):
         bx0 = self.x0.copy()
         x, info = gmres(self.A, self.b, self.x0, callback=callback)
         assert_array_equal(bx0, self.x0)
         assert norm(dot(self.A, x) - self.b) < 5*self.tol
 
-    def check_qmr(self):
+    def test_qmr(self):
         bx0 = self.x0.copy()
         x, info = qmr(self.A, self.b, self.x0, callback=callback)
         assert_array_equal(bx0, self.x0)
         assert norm(dot(self.A, x) - self.b) < 5*self.tol
 
 if __name__ == "__main__":
-    NumpyTest().run()
+    unittest.main()

Modified: branches/testing_cleanup/scipy/linalg/tests/test_lapack.py
===================================================================
--- branches/testing_cleanup/scipy/linalg/tests/test_lapack.py	2008-01-01 22:00:03 UTC (rev 3760)
+++ branches/testing_cleanup/scipy/linalg/tests/test_lapack.py	2008-01-02 04:07:30 UTC (rev 3761)
@@ -3,26 +3,17 @@
 # Created by: Pearu Peterson, September 2002
 #
 
-__usage__ = """
-Build linalg:
-  python setup_linalg.py build
-Run tests if scipy is installed:
-  python -c 'import scipy;scipy.linalg.test(<level>)'
-Run tests if linalg is not installed:
-  python tests/test_lapack.py [<level>]
-"""
 
 import sys
-from numpy.testing import *
+from scipy.testing import *
 from numpy import ones
-set_package_path()
-from linalg import flapack
-from linalg import clapack
-restore_path()
 
-class TestFlapackSimple(NumpyTestCase):
+from scipy.linalg import flapack, clapack
 
-    def check_gebal(self):
+
+class TestFlapackSimple(TestCase):
+
+    def test_gebal(self):
         a = [[1,2,3],[4,5,6],[7,8,9]]
         a1 = [[1,0,0,3e-4],
               [4,0,0,2e-3],
@@ -42,7 +33,7 @@
             #print a1
             #print ba,lo,hi,pivscale
 
-    def check_gehrd(self):
+    def test_gehrd(self):
         a = [[-149, -50,-154],
              [ 537, 180, 546],
              [ -27,  -9, -25]]
@@ -52,9 +43,9 @@
             ht,tau,info = f(a)
             assert not info,`info`
 
-class TestLapack(NumpyTestCase):
+class TestLapack(TestCase):
 
-    def check_flapack(self):
+    def test_flapack(self):
         if hasattr(flapack,'empty_module'):
             print """
 ****************************************************************
@@ -63,7 +54,7 @@
 See scipy/INSTALL.txt for troubleshooting.
 ****************************************************************
 """
-    def check_clapack(self):
+    def test_clapack(self):
         if hasattr(clapack,'empty_module'):
             print """
 ****************************************************************
@@ -77,4 +68,4 @@
 """
 
 if __name__ == "__main__":
-    NumpyTest().run()
+    unittest.main()

Modified: branches/testing_cleanup/scipy/linalg/tests/test_matfuncs.py
===================================================================
--- branches/testing_cleanup/scipy/linalg/tests/test_matfuncs.py	2008-01-01 22:00:03 UTC (rev 3760)
+++ branches/testing_cleanup/scipy/linalg/tests/test_matfuncs.py	2008-01-02 04:07:30 UTC (rev 3761)
@@ -5,29 +5,21 @@
 """ Test functions for linalg.matfuncs module
 
 """
-__usage__ = """
-Build linalg:
-  python setup_linalg.py build
-Run tests if scipy is installed:
-  python -c 'import scipy;scipy.linalg.test(<level>)'
-Run tests if linalg is not installed:
-  python tests/test_matfuncs.py [<level>]
-"""
 
-from numpy import array, identity
-
 import sys
-from numpy.testing import *
-set_package_path()
+
 import numpy
-from numpy import dot,sqrt
-import linalg
-from linalg import signm,logm,funm, sqrtm, expm, expm2, expm3
-restore_path()
+from numpy import array, identity, dot, sqrt
 
-class TestSignM(NumpyTestCase):
+from scipy.testing import *
 
-    def check_nils(self):
+import scipy.linalg
+from scipy.linalg import signm,logm,funm, sqrtm, expm, expm2, expm3
+
+
+class TestSignM(TestCase):
+
+    def test_nils(self):
         a = array([[ 29.2, -24.2,  69.5,  49.8,   7. ],
                    [ -9.2,   5.2, -18. , -16.8,  -2. ],
                    [-10. ,   6. , -20. , -18. ,  -2. ],
@@ -41,12 +33,12 @@
         r = signm(a)
         assert_array_almost_equal(r,cr)
 
-    def check_defective1(self):
+    def test_defective1(self):
         a = array([[0.0,1,0,0],[1,0,1,0],[0,0,0,1],[0,0,1,0]])
         r = signm(a)
         #XXX: what would be the correct result?
 
-    def check_defective2(self):
+    def test_defective2(self):
         a = array((
             [29.2,-24.2,69.5,49.8,7.0],
             [-9.2,5.2,-18.0,-16.8,-2.0],
@@ -56,7 +48,7 @@
         r = signm(a)
         #XXX: what would be the correct result?
 
-    def check_defective3(self):
+    def test_defective3(self):
         a = array([[ -2.,  25.,   0.,   0.,   0.,   0.,   0.],
                    [  0.,  -3.,  10.,   3.,   3.,   3.,   0.],
                    [  0.,   0.,   2.,  15.,   3.,   3.,   0.],
@@ -67,9 +59,9 @@
         r = signm(a)
         #XXX: what would be the correct result?
 
-class TestLogM(NumpyTestCase):
+class TestLogM(TestCase):
 
-    def check_nils(self):
+    def test_nils(self):
         a = array([[ -2.,  25.,   0.,   0.,   0.,   0.,   0.],
                    [  0.,  -3.,  10.,   3.,   3.,   3.,   0.],
                    [  0.,   0.,   2.,  15.,   3.,   3.,   0.],
@@ -81,8 +73,8 @@
         logm(m)
 
 
-class TestSqrtM(NumpyTestCase):
-    def check_bad(self):
+class TestSqrtM(TestCase):
+    def test_bad(self):
         # See http://www.maths.man.ac.uk/~nareports/narep336.ps.gz
         e = 2**-5
         se = sqrt(e)
@@ -98,12 +90,12 @@
         esa = sqrtm(a)
         assert_array_almost_equal(dot(esa,esa),a)
 
-class TestExpM(NumpyTestCase):
-    def check_zero(self):
+class TestExpM(TestCase):
+    def test_zero(self):
         a = array([[0.,0],[0,0]])
         assert_array_almost_equal(expm(a),[[1,0],[0,1]])
         assert_array_almost_equal(expm2(a),[[1,0],[0,1]])
         assert_array_almost_equal(expm3(a),[[1,0],[0,1]])
 
 if __name__ == "__main__":
-    NumpyTest().run()
+    unittest.main()

Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py
===================================================================
--- branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py	2008-01-01 22:00:03 UTC (rev 3760)
+++ branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py	2008-01-02 04:07:30 UTC (rev 3761)
@@ -49,6 +49,7 @@
     def test_big(self,level=5):
         print 'Big, slow test'
 
+
 def test_simplefunction():
     """A simple test function."""
     assert True

Modified: branches/testing_cleanup/scipy/sandbox/timeseries/dates.py
===================================================================
--- branches/testing_cleanup/scipy/sandbox/timeseries/dates.py	2008-01-01 22:00:03 UTC (rev 3760)
+++ branches/testing_cleanup/scipy/sandbox/timeseries/dates.py	2008-01-02 04:07:30 UTC (rev 3761)
@@ -617,9 +617,26 @@
 
 def date_array(dlist=None, start_date=None, end_date=None, length=None,
                freq=None):
-    """Constructs a DateArray from:
-    - a starting date and either an ending date or a given length.
-    - a list of dates.
+    """Factory function for constructing a DateArray
+
+*Parameters*:
+    dlist : {list of dates or DateArray} (optional)
+        may be a list of dates, integer representations of dates for a given
+        frequency, datetime objects, or an existing DateArray. If specifying
+        a list of dates, you must also specify the `freq` parameter.
+
+    start_date : {Date} (optional)
+        if you want a continuous DateArray, specify a start_date and either an
+        `end_date` or a `length`. Frequency of the resulting DateArray will be
+        automatically determined based on the frequency of this parameter.
+
+    end_date : {Date} (optional)
+        last date in resulting DateArray. Specify this parameter or `length`
+        in combination with `start_date` for a continuous DateArray.
+
+    length : {int} (optional)
+        the length of the resulting DateArray. Specify this parameter or
+        `end_date` in combination with `start_date` for a continuous DateArray.
     """
     freq = check_freq(freq)
     # Case #1: we have a list ...................

Modified: branches/testing_cleanup/scipy/sparse/construct.py
===================================================================
--- branches/testing_cleanup/scipy/sparse/construct.py	2008-01-01 22:00:03 UTC (rev 3760)
+++ branches/testing_cleanup/scipy/sparse/construct.py	2008-01-02 04:07:30 UTC (rev 3761)
@@ -12,6 +12,7 @@
 
 from csr import csr_matrix, isspmatrix_csr
 from csc import csc_matrix, isspmatrix_csc
+from bsr import bsr_matrix
 from coo import coo_matrix
 from dok import dok_matrix
 from lil import lil_matrix
@@ -96,36 +97,56 @@
 
     """
     #TODO optimize for small dense B and CSR A
-    A,B = coo_matrix(A),coo_matrix(B)
-    output_shape = (A.shape[0]*B.shape[0],A.shape[1]*B.shape[1])
+    B = coo_matrix(B)
 
-    if A.nnz == 0 or B.nnz == 0:
-        # kronecker product is the zero matrix
-        return coo_matrix( output_shape )
+    
+    if (format is None or format == "bsr") and 2*B.nnz >= B.shape[0] * B.shape[1]:
+        #B is fairly dense, use BSR
+        A = csr_matrix(A,copy=True)
+        
+        output_shape = (A.shape[0]*B.shape[0],A.shape[1]*B.shape[1])
 
-    # expand entries of a into blocks
-    row  = A.row.repeat(B.nnz)
-    col  = A.col.repeat(B.nnz)
-    data = A.data.repeat(B.nnz)
+        if A.nnz == 0 or B.nnz == 0:
+            # kronecker product is the zero matrix
+            return coo_matrix( output_shape )
+        
+        B = B.toarray()
+        data = A.data.repeat(B.size).reshape(-1,B.shape[0],B.shape[1])
+        data = data * B
+        
+        return bsr_matrix((data,A.indices,A.indptr),shape=output_shape)
+    else:
+        #use COO
+        A = coo_matrix(A)
+        output_shape = (A.shape[0]*B.shape[0],A.shape[1]*B.shape[1])
 
-    row *= B.shape[0]
-    col *= B.shape[1]
+        if A.nnz == 0 or B.nnz == 0:
+            # kronecker product is the zero matrix
+            return coo_matrix( output_shape )
 
-    # increment block indices
-    row,col = row.reshape(-1,B.nnz),col.reshape(-1,B.nnz)
-    row += B.row
-    col += B.col
-    row,col = row.reshape(-1),col.reshape(-1)
+        # expand entries of a into blocks
+        row  = A.row.repeat(B.nnz)
+        col  = A.col.repeat(B.nnz)
+        data = A.data.repeat(B.nnz)
 
-    # compute block entries
-    data = data.reshape(-1,B.nnz) * B.data
-    data = data.reshape(-1)
+        row *= B.shape[0]
+        col *= B.shape[1]
 
-    return coo_matrix((data,(row,col)), shape=output_shape).asformat(format)
+        # increment block indices
+        row,col = row.reshape(-1,B.nnz),col.reshape(-1,B.nnz)
+        row += B.row
+        col += B.col
+        row,col = row.reshape(-1),col.reshape(-1)
 
+        # compute block entries
+        data = data.reshape(-1,B.nnz) * B.data
+        data = data.reshape(-1)
 
+        return coo_matrix((data,(row,col)), shape=output_shape).asformat(format)
 
 
+
+
 def lil_eye((r,c), k=0, dtype='d'):
     """Generate a lil_matrix of dimensions (r,c) with the k-th
     diagonal set to 1.

Modified: branches/testing_cleanup/scipy/sparse/tests/test_sparse.py
===================================================================
--- branches/testing_cleanup/scipy/sparse/tests/test_sparse.py	2008-01-01 22:00:03 UTC (rev 3760)
+++ branches/testing_cleanup/scipy/sparse/tests/test_sparse.py	2008-01-02 04:07:30 UTC (rev 3761)
@@ -77,8 +77,7 @@
             vars = dict( [(var,mat.asformat(format)) for (var,name,mat) in matrices ] )
             for X,Y in [ ('A','A'),('A','B'),('B','A'),('B','B') ]:
                 x,y = vars[X],vars[Y]
-                #for op in ['__add__','__sub__','multiply','__div__','__mul__']:
-                for op in ['__mul__']:
+                for op in ['__add__','__sub__','multiply','__div__','__mul__']:
                     fn = getattr(x,op)
                     fn(y) #warmup
 



More information about the Scipy-svn mailing list