[Scipy-svn] r6829 - trunk/scipy/weave/tests

scipy-svn@scip... scipy-svn@scip...
Sat Oct 9 23:40:48 CDT 2010


Author: warren.weckesser
Date: 2010-10-09 23:40:47 -0500 (Sat, 09 Oct 2010)
New Revision: 6829

Modified:
   trunk/scipy/weave/tests/test_ast_tools.py
   trunk/scipy/weave/tests/test_blitz_tools.py
   trunk/scipy/weave/tests/test_build_tools.py
   trunk/scipy/weave/tests/test_c_spec.py
   trunk/scipy/weave/tests/test_catalog.py
   trunk/scipy/weave/tests/test_ext_tools.py
   trunk/scipy/weave/tests/test_inline_tools.py
   trunk/scipy/weave/tests/test_numpy_scalar_spec.py
   trunk/scipy/weave/tests/test_scxx_dict.py
   trunk/scipy/weave/tests/test_scxx_object.py
   trunk/scipy/weave/tests/test_scxx_sequence.py
   trunk/scipy/weave/tests/test_size_check.py
   trunk/scipy/weave/tests/test_slice_handler.py
   trunk/scipy/weave/tests/test_standard_array_spec.py
Log:
TST: weave: Don't use 'import *'.  Don't use plain 'assert'. Rename a couple duplicated tests. Clean up a bit.

Modified: trunk/scipy/weave/tests/test_ast_tools.py
===================================================================
--- trunk/scipy/weave/tests/test_ast_tools.py	2010-10-01 10:23:34 UTC (rev 6828)
+++ trunk/scipy/weave/tests/test_ast_tools.py	2010-10-10 04:40:47 UTC (rev 6829)
@@ -1,8 +1,8 @@
-from numpy.testing import *
+from numpy.testing import TestCase, assert_equal
 
 from scipy.weave import ast_tools
-from weave_test_utils import *
 
+
 class TestHarvestVariables(TestCase):
     """ Not much testing going on here, but
         at least it is a flame test.

Modified: trunk/scipy/weave/tests/test_blitz_tools.py
===================================================================
--- trunk/scipy/weave/tests/test_blitz_tools.py	2010-10-01 10:23:34 UTC (rev 6828)
+++ trunk/scipy/weave/tests/test_blitz_tools.py	2010-10-10 04:40:47 UTC (rev 6829)
@@ -4,11 +4,11 @@
 from numpy import float32, float64, complex64, complex128, \
      zeros, random, array, sum, abs, allclose
 
-from numpy.testing import *
+from numpy.testing import TestCase, dec, assert_equal, assert_
 
 from scipy.weave import blitz_tools
 from scipy.weave.ast_tools import harvest_variables
-from weave_test_utils import *
+from weave_test_utils import empty_temp_dir, cleanup_temp_dir, remove_whitespace
 
 
 class TestAstToBlitzExpr(TestCase):
@@ -80,7 +80,7 @@
         try:
             # this isn't very stringent.  Need to tighten this up and
             # learn where failures are occuring.
-            assert(allclose(abs(actual.ravel()),abs(desired.ravel()),1e-4,1e-6))
+            assert_(allclose(abs(actual.ravel()),abs(desired.ravel()),1e-4,1e-6))
         except:
             diff = actual-desired
             print diff[:4,:4]
@@ -127,10 +127,12 @@
             print "2nd run(numpy.numerix,compiled,speed up):  %3.4f, %3.4f, " \
                   "%3.4f" % (standard,compiled,speed_up)
         cleanup_temp_dir(mod_location)
+
     #def test_simple_2d(self):
     #    """ result = a + b"""
     #    expr = "result = a + b"
     #    self.generic_2d(expr)
+
     @dec.slow
     def test_5point_avg_2d_float(self):
         """ result[1:-1,1:-1] = (b[1:-1,1:-1] + b[2:,1:-1] + b[:-2,1:-1]
@@ -177,6 +179,7 @@
                                   "+ b[1:-1,2:] + b[1:-1,:-2]) / 5."
         self.generic_2d(expr,complex128)
 
+
 if __name__ == "__main__":
     import nose
     nose.run(argv=['', __file__])

Modified: trunk/scipy/weave/tests/test_build_tools.py
===================================================================
--- trunk/scipy/weave/tests/test_build_tools.py	2010-10-01 10:23:34 UTC (rev 6828)
+++ trunk/scipy/weave/tests/test_build_tools.py	2010-10-10 04:40:47 UTC (rev 6829)
@@ -4,7 +4,7 @@
 
 import os, sys, tempfile, warnings
 
-from numpy.testing import *
+from numpy.testing import TestCase, assert_
 
 from scipy.weave import build_tools
 
@@ -16,41 +16,50 @@
 def is_writable(val):
     return os.access(val,os.W_OK)
 
+
 class TestConfigureBuildDir(TestCase):
+
     def test_default(self):
         " default behavior is to return current directory "
         d = build_tools.configure_build_dir()
         if is_writable('.'):
-            assert(d == os.path.abspath('.'))
-        assert(is_writable(d))
+            assert_(d == os.path.abspath('.'))
+        assert_(is_writable(d))
+
     def test_curdir(self):
         " make sure it handles relative values. "
         d = build_tools.configure_build_dir('.')
         if is_writable('.'):
-            assert(d == os.path.abspath('.'))
-        assert(is_writable(d))
+            assert_(d == os.path.abspath('.'))
+        assert_(is_writable(d))
+
     def test_pardir(self):
         " make sure it handles relative values "
         d = build_tools.configure_build_dir('..')
         if is_writable('..'):
-            assert(d == os.path.abspath('..'))
-        assert(is_writable(d))
+            assert_(d == os.path.abspath('..'))
+        assert_(is_writable(d))
+
     def test_bad_path(self):
         " bad path should return same as default (and warn) "
         d = build_tools.configure_build_dir('_bad_path_')
         d2 = build_tools.configure_build_dir()
-        assert(d == d2)
-        assert(is_writable(d))
+        assert_(d == d2)
+        assert_(is_writable(d))
 
+
 class TestConfigureTempDir(TestConfigureBuildDir):
+
     def test_default(self):
         " default behavior returns tempdir"
         # this'll fail if the temp directory isn't writable.
         d = build_tools.configure_temp_dir()
-        assert(d == tempfile.gettempdir())
-        assert(is_writable(d))
+        assert_(d == tempfile.gettempdir())
+        assert_(is_writable(d))
 
+
 class TestConfigureSysArgv(TestCase):
+
     def test_simple(self):
         build_dir = 'build_dir'
         temp_dir = 'temp_dir'
@@ -59,13 +68,14 @@
         build_tools.configure_sys_argv(compiler,temp_dir,build_dir)
         argv = sys.argv[:]
         bd = argv[argv.index('--build-lib')+1]
-        assert(bd == build_dir)
+        assert_(bd == build_dir)
         td = argv[argv.index('--build-temp')+1]
-        assert(td == temp_dir)
+        assert_(td == temp_dir)
         argv.index('--compiler='+compiler)
         build_tools.restore_sys_argv()
-        assert(pre_argv == sys.argv[:])
+        assert_(pre_argv == sys.argv[:])
 
+
 if __name__ == "__main__":
     import nose
     nose.run(argv=['', __file__])

Modified: trunk/scipy/weave/tests/test_c_spec.py
===================================================================
--- trunk/scipy/weave/tests/test_c_spec.py	2010-10-01 10:23:34 UTC (rev 6828)
+++ trunk/scipy/weave/tests/test_c_spec.py	2010-10-10 04:40:47 UTC (rev 6829)
@@ -8,7 +8,7 @@
 global test_dir
 test_dir = ''
 
-from numpy.testing import *
+from numpy.testing import TestCase, dec, assert_
 
 from scipy.weave import inline_tools,ext_tools,c_spec
 from scipy.weave.build_tools import msvc_exists, gcc_exists
@@ -48,23 +48,29 @@
 
 
 class IntConverter(TestCase):
+
     compiler = ''
+
     @dec.slow
     def test_type_match_string(self):
         s = c_spec.int_converter()
-        assert( not s.type_match('string') )
+        assert_( not s.type_match('string') )
+
     @dec.slow
     def test_type_match_int(self):
         s = c_spec.int_converter()
-        assert(s.type_match(5))
+        assert_(s.type_match(5))
+
     @dec.slow
     def test_type_match_float(self):
         s = c_spec.int_converter()
-        assert(not s.type_match(5.))
+        assert_(not s.type_match(5.))
+
     @dec.slow
     def test_type_match_complex(self):
         s = c_spec.int_converter()
-        assert(not s.type_match(5.+1j))
+        assert_(not s.type_match(5.+1j))
+
     @dec.slow
     def test_var_in(self):
         mod_name = 'int_var_in' + self.compiler
@@ -106,26 +112,33 @@
         b=1
         c = test(b)
 
-        assert( c == 3)
+        assert_( c == 3)
 
+
 class FloatConverter(TestCase):
+
     compiler = ''
+
     @dec.slow
     def test_type_match_string(self):
         s = c_spec.float_converter()
-        assert( not s.type_match('string'))
+        assert_( not s.type_match('string'))
+
     @dec.slow
     def test_type_match_int(self):
         s = c_spec.float_converter()
-        assert(not s.type_match(5))
+        assert_(not s.type_match(5))
+
     @dec.slow
     def test_type_match_float(self):
         s = c_spec.float_converter()
-        assert(s.type_match(5.))
+        assert_(s.type_match(5.))
+
     @dec.slow
     def test_type_match_complex(self):
         s = c_spec.float_converter()
-        assert(not s.type_match(5.+1j))
+        assert_(not s.type_match(5.+1j))
+
     @dec.slow
     def test_float_var_in(self):
         mod_name = sys._getframe().f_code.co_name + self.compiler
@@ -150,7 +163,6 @@
         except TypeError:
             pass
 
-
     @dec.slow
     def test_float_return(self):
         mod_name = sys._getframe().f_code.co_name + self.compiler
@@ -167,26 +179,33 @@
         exec 'from ' + mod_name + ' import test'
         b=1.
         c = test(b)
-        assert( c == 3.)
+        assert_( c == 3.)
 
+
 class ComplexConverter(TestCase):
+
     compiler = ''
+
     @dec.slow
     def test_type_match_string(self):
         s = c_spec.complex_converter()
-        assert( not s.type_match('string') )
+        assert_( not s.type_match('string') )
+
     @dec.slow
     def test_type_match_int(self):
         s = c_spec.complex_converter()
-        assert(not s.type_match(5))
+        assert_(not s.type_match(5))
+
     @dec.slow
     def test_type_match_float(self):
         s = c_spec.complex_converter()
-        assert(not s.type_match(5.))
+        assert_(not s.type_match(5.))
+
     @dec.slow
     def test_type_match_complex(self):
         s = c_spec.complex_converter()
-        assert(s.type_match(5.+1j))
+        assert_(s.type_match(5.+1j))
+
     @dec.slow
     def test_complex_var_in(self):
         mod_name = sys._getframe().f_code.co_name + self.compiler
@@ -227,14 +246,17 @@
         exec 'from ' + mod_name + ' import test'
         b=1.+1j
         c = test(b)
-        assert( c == 3.+3j)
+        assert_( c == 3.+3j)
 
+
 #----------------------------------------------------------------------------
 # File conversion tests
 #----------------------------------------------------------------------------
 
 class FileConverter(TestCase):
+
     compiler = ''
+
     @dec.slow
     def test_py_to_file(self):
         import tempfile
@@ -246,7 +268,8 @@
         inline_tools.inline(code,['file'],compiler=self.compiler,force=1)
         file.close()
         file = open(file_name,'r')
-        assert(file.read() == "hello bob")
+        assert_(file.read() == "hello bob")
+
     @dec.slow
     def test_file_to_py(self):
         import tempfile
@@ -263,8 +286,9 @@
         file.write("hello fred")
         file.close()
         file = open(file_name,'r')
-        assert(file.read() == "hello fred")
+        assert_(file.read() == "hello fred")
 
+
 #----------------------------------------------------------------------------
 # Instance conversion tests
 #----------------------------------------------------------------------------
@@ -272,12 +296,15 @@
 class InstanceConverter(TestCase):
     pass
 
+
 #----------------------------------------------------------------------------
 # Callable object conversion tests
 #----------------------------------------------------------------------------
 
 class CallableConverter(TestCase):
+
     compiler=''
+
     @dec.slow
     def test_call_function(self):
         import string
@@ -295,45 +322,58 @@
         actual = inline_tools.inline(code,['func','search_str','sub_str'],
                                      compiler=self.compiler,force=1)
         desired = func(search_str,sub_str)
-        assert(desired == actual)
+        assert_(desired == actual)
 
+
 class SequenceConverter(TestCase):
+
     compiler = ''
+
     @dec.slow
     def test_convert_to_dict(self):
         d = {}
         inline_tools.inline("",['d'],compiler=self.compiler,force=1)
+
     @dec.slow
     def test_convert_to_list(self):
         l = []
         inline_tools.inline("",['l'],compiler=self.compiler,force=1)
+
     @dec.slow
     def test_convert_to_string(self):
         s = 'hello'
         inline_tools.inline("",['s'],compiler=self.compiler,force=1)
+
     @dec.slow
     def test_convert_to_tuple(self):
         t = ()
         inline_tools.inline("",['t'],compiler=self.compiler,force=1)
 
+
 class StringConverter(TestCase):
+
     compiler = ''
+
     @dec.slow
     def test_type_match_string(self):
         s = c_spec.string_converter()
-        assert( s.type_match('string') )
+        assert_( s.type_match('string') )
+
     @dec.slow
     def test_type_match_int(self):
         s = c_spec.string_converter()
-        assert(not s.type_match(5))
+        assert_(not s.type_match(5))
+
     @dec.slow
     def test_type_match_float(self):
         s = c_spec.string_converter()
-        assert(not s.type_match(5.))
+        assert_(not s.type_match(5.))
+
     @dec.slow
     def test_type_match_complex(self):
         s = c_spec.string_converter()
-        assert(not s.type_match(5.+1j))
+        assert_(not s.type_match(5.+1j))
+
     @dec.slow
     def test_var_in(self):
         mod_name = 'string_var_in'+self.compiler
@@ -375,20 +415,25 @@
         exec 'from ' + mod_name + ' import test'
         b='bub'
         c = test(b)
-        assert( c == 'hello')
+        assert_( c == 'hello')
 
+
 class ListConverter(TestCase):
+
     compiler = ''
+
     @dec.slow
     def test_type_match_bad(self):
         s = c_spec.list_converter()
         objs = [{},(),'',1,1.,1+1j]
         for i in objs:
-            assert( not s.type_match(i) )
+            assert_( not s.type_match(i) )
+
     @dec.slow
     def test_type_match_good(self):
         s = c_spec.list_converter()
-        assert(s.type_match([]))
+        assert_(s.type_match([]))
+
     @dec.slow
     def test_var_in(self):
         mod_name = 'list_var_in'+self.compiler
@@ -430,7 +475,7 @@
         exec 'from ' + mod_name + ' import test'
         b=[1,2]
         c = test(b)
-        assert( c == ['hello'])
+        assert_( c == ['hello'])
 
     @dec.slow
     def test_speed(self):
@@ -491,20 +536,25 @@
                 sum3 -= i
         t2 = time.time()
         print 'python:', t2 - t1
-        assert( sum1 == sum2 and sum1 == sum3)
+        assert_( sum1 == sum2 and sum1 == sum3)
 
+
 class TupleConverter(TestCase):
+
     compiler = ''
+
     @dec.slow
     def test_type_match_bad(self):
         s = c_spec.tuple_converter()
         objs = [{},[],'',1,1.,1+1j]
         for i in objs:
-            assert( not s.type_match(i) )
+            assert_( not s.type_match(i) )
+
     @dec.slow
     def test_type_match_good(self):
         s = c_spec.tuple_converter()
-        assert(s.type_match((1,)))
+        assert_(s.type_match((1,)))
+
     @dec.slow
     def test_var_in(self):
         mod_name = 'tuple_var_in'+self.compiler
@@ -547,7 +597,7 @@
         exec 'from ' + mod_name + ' import test'
         b=(1,2)
         c = test(b)
-        assert( c == ('hello',None))
+        assert_( c == ('hello',None))
 
 
 class DictConverter(TestCase):
@@ -565,11 +615,13 @@
         s = c_spec.dict_converter()
         objs = [[],(),'',1,1.,1+1j]
         for i in objs:
-            assert( not s.type_match(i) )
+            assert_( not s.type_match(i) )
+
     @dec.slow
     def test_type_match_good(self):
         s = c_spec.dict_converter()
-        assert(s.type_match({}))
+        assert_(s.type_match({}))
+
     @dec.slow
     def test_var_in(self):
         mod_name = 'dict_var_in'+self.compiler
@@ -611,8 +663,9 @@
         exec 'from ' + mod_name + ' import test'
         b = {'z':2}
         c = test(b)
-        assert( c['hello'] == 5)
+        assert_( c['hello'] == 5)
 
+
 # for compiler in compilers:
     # for name,klass in globals().iteritems():
     #     if name[:4]=="Test" and name[-9:] == "Converter":
@@ -739,6 +792,7 @@
 #     for _n in dir():
 #         if _n[:7]=='TestGcc': exec 'del '+_n
 #
+
 if __name__ == "__main__":
     import nose
     nose.run(argv=['', __file__])

Modified: trunk/scipy/weave/tests/test_catalog.py
===================================================================
--- trunk/scipy/weave/tests/test_catalog.py	2010-10-01 10:23:34 UTC (rev 6828)
+++ trunk/scipy/weave/tests/test_catalog.py	2010-10-10 04:40:47 UTC (rev 6829)
@@ -1,11 +1,11 @@
 import sys
 import os
 
+from numpy.testing import TestCase, assert_
 
-from numpy.testing import *
-
 from scipy.weave import catalog
-from weave_test_utils import *
+from weave_test_utils import clear_temp_catalog, restore_temp_catalog, \
+        empty_temp_dir, cleanup_temp_dir
 
 
 class TestDefaultDir(TestCase):
@@ -19,54 +19,64 @@
             test_file.close()
             os.remove(name)
 
+
 class TestOsDependentCatalogName(TestCase):
     pass
 
+
 class TestCatalogPath(TestCase):
+
     def test_default(self):
         in_path = catalog.default_dir()
         path = catalog.catalog_path(in_path)
         d,f = os.path.split(path)
-        assert(d == in_path)
-        assert(f == catalog.os_dependent_catalog_name())
+        assert_(d == in_path)
+        assert_(f == catalog.os_dependent_catalog_name())
+
     def test_current(self):
         in_path = '.'
         path = catalog.catalog_path(in_path)
         d,f = os.path.split(path)
-        assert(d == os.path.abspath(in_path))
-        assert(f == catalog.os_dependent_catalog_name())
+        assert_(d == os.path.abspath(in_path))
+        assert_(f == catalog.os_dependent_catalog_name())
+
     def test_user(path):
         if sys.platform != 'win32':
             in_path = '~'
             path = catalog.catalog_path(in_path)
             d,f = os.path.split(path)
-            assert(d == os.path.expanduser(in_path))
-            assert(f == catalog.os_dependent_catalog_name())
+            assert_(d == os.path.expanduser(in_path))
+            assert_(f == catalog.os_dependent_catalog_name())
+
     def test_module(self):
         # hand it a module and see if it uses the parent directory
         # of the module.
         path = catalog.catalog_path(os.__file__)
         d,f = os.path.split(os.__file__)
         d2,f = os.path.split(path)
-        assert (d2 == d)
+        assert_(d2 == d)
+
     def test_path(self):
         # use os.__file__ to get a usable directory.
         in_path,f = os.path.split(os.__file__)
         path = catalog.catalog_path(in_path)
         d,f = os.path.split(path)
-        assert (d == in_path)
+        assert_(d == in_path)
+
     def test_bad_path(self):
         # stupid_path_name
         in_path = 'stupid_path_name'
         path = catalog.catalog_path(in_path)
-        assert (path is None)
+        assert_(path is None)
 
+
 class TestGetCatalog(TestCase):
     """ This only tests whether new catalogs are created correctly.
         And whether non-existent return None correctly with read mode.
         Putting catalogs in the right place is all tested with
         catalog_dir tests.
     """
+
     def get_test_dir(self,erase = 0):
         # make sure tempdir catalog doesn't exist
         import tempfile, glob
@@ -80,6 +90,7 @@
             for cat_file in cat_files:
                 os.remove(cat_file)
         return pardir
+
     def remove_dir(self,d):
         import distutils.dir_util
         distutils.dir_util.remove_tree(d)
@@ -88,13 +99,15 @@
         pardir = self.get_test_dir(erase=1)
         cat = catalog.get_catalog(pardir,'r')
         self.remove_dir(pardir)
-        assert(cat is None)
+        assert_(cat is None)
+
     def test_create_catalog(self):
         pardir = self.get_test_dir(erase=1)
         cat = catalog.get_catalog(pardir,'c')
         self.remove_dir(pardir)
-        assert(cat is not None)
+        assert_(cat is not None)
 
+
 class TestCatalog(TestCase):
 
     def clear_environ(self):
@@ -103,12 +116,15 @@
             del os.environ['PYTHONCOMPILED']
         else:
             self.old_PYTHONCOMPILED = None
+
     def reset_environ(self):
         if self.old_PYTHONCOMPILED:
             os.environ['PYTHONCOMPILED'] = self.old_PYTHONCOMPILED
             self.old_PYTHONCOMPILED = None
+
     def setUp(self):
         self.clear_environ()
+
     def tearDown(self):
         self.reset_environ()
 
@@ -116,58 +132,66 @@
         q = catalog.catalog()
         q.set_module_directory('bob')
         r = q.get_module_directory()
-        assert (r == 'bob')
+        assert_(r == 'bob')
+
     def test_clear_module_directory(self):
         q = catalog.catalog()
         r = q.get_module_directory()
-        assert (r is None)
+        assert_(r is None)
         q.set_module_directory('bob')
         r = q.clear_module_directory()
-        assert (r is None)
+        assert_(r is None)
+
     def test_get_environ_path(self):
         if sys.platform == 'win32': sep = ';'
         else: sep = ':'
         os.environ['PYTHONCOMPILED'] = sep.join(('path1','path2','path3'))
         q = catalog.catalog()
         path = q.get_environ_path()
-        assert(path == ['path1','path2','path3'])
+        assert_(path == ['path1','path2','path3'])
+
     def test_build_search_order1(self):
         """ MODULE in search path should be replaced by module_dir.
         """
         q = catalog.catalog(['first','MODULE','third'])
         q.set_module_directory('second')
         order = q.build_search_order()
-        assert(order == ['first','second','third',catalog.default_dir()])
+        assert_(order == ['first','second','third',catalog.default_dir()])
+
     def test_build_search_order2(self):
         """ MODULE in search path should be removed if module_dir==None.
         """
         q = catalog.catalog(['first','MODULE','third'])
         order = q.build_search_order()
-        assert(order == ['first','third',catalog.default_dir()])
+        assert_(order == ['first','third',catalog.default_dir()])
+
     def test_build_search_order3(self):
         """ If MODULE is absent, module_dir shouldn't be in search path.
         """
         q = catalog.catalog(['first','second'])
         q.set_module_directory('third')
         order = q.build_search_order()
-        assert(order == ['first','second',catalog.default_dir()])
+        assert_(order == ['first','second',catalog.default_dir()])
+
     def test_build_search_order4(self):
         """ Make sure environment variable is getting used.
         """
         q = catalog.catalog(['first','second'])
-        if sys.platform == 'win32': sep = ';'
-        else: sep = ':'
+        if sys.platform == 'win32':
+            sep = ';'
+        else:
+            sep = ':'
         os.environ['PYTHONCOMPILED'] = sep.join(('MODULE','fourth','fifth'))
         q.set_module_directory('third')
         order = q.build_search_order()
-        assert(order == ['first','second','third','fourth','fifth',catalog.default_dir()])
+        assert_(order == ['first','second','third','fourth','fifth',catalog.default_dir()])
 
     def test_catalog_files1(self):
         """ Be sure we get at least one file even without specifying the path.
         """
         q = catalog.catalog()
         files = q.get_catalog_files()
-        assert(len(files) == 1)
+        assert_(len(files) == 1)
 
     def test_catalog_files2(self):
         """ Ignore bad paths in the path.
@@ -175,7 +199,7 @@
         q = catalog.catalog()
         os.environ['PYTHONCOMPILED'] = '_some_bad_path_'
         files = q.get_catalog_files()
-        assert(len(files) == 1)
+        assert_(len(files) == 1)
 
     def test_get_existing_files1(self):
         """ Shouldn't get any files when temp doesn't exist and no path set.
@@ -184,7 +208,8 @@
         q = catalog.catalog()
         files = q.get_existing_files()
         restore_temp_catalog()
-        assert(len(files) == 0)
+        assert_(len(files) == 0)
+
     def test_get_existing_files2(self):
         """ Shouldn't get a single file from the temp dir.
         """
@@ -197,7 +222,7 @@
         q = catalog.catalog()
         files = q.get_existing_files()
         restore_temp_catalog()
-        assert(len(files) == 1)
+        assert_(len(files) == 1)
 
     def test_access_writable_file(self):
         """ There should always be a writable file -- even if it is in temp
@@ -210,12 +235,15 @@
         finally:
             f.close()
             os.remove(file)
+
     def test_writable_with_bad_path(self):
         """ There should always be a writable file -- even if search paths contain
             bad values.
         """
-        if sys.platform == 'win32': sep = ';'
-        else: sep = ':'
+        if sys.platform == 'win32':
+            sep = ';'
+        else:
+            sep = ':'
         os.environ['PYTHONCOMPILED'] = sep.join(('_bad_path_name_'))
         q = catalog.catalog()
         file = q.get_writable_file()
@@ -225,6 +253,7 @@
         finally:
             f.close()
         os.remove(file)
+
     def test_writable_dir(self):
         """ Check that we can create a file in the writable directory
         """
@@ -237,14 +266,15 @@
         finally:
             f.close()
             os.remove(file)
+
     def test_unique_module_name(self):
         """ Check that we can create a file in the writable directory
         """
         q = catalog.catalog()
         file = q.unique_module_name('bob')
         cfile1 = file+'.cpp'
-        assert(not os.path.exists(cfile1))
-        #make sure it is writable
+        assert_(not os.path.exists(cfile1))
+        # Make sure it is writable
         try:
             f = open(cfile1,'w')
             f.write('bob')
@@ -253,8 +283,9 @@
         # try again with same code fragment -- should get unique name
         file = q.unique_module_name('bob')
         cfile2 = file+'.cpp'
-        assert(not os.path.exists(cfile2+'.cpp'))
+        assert_(not os.path.exists(cfile2+'.cpp'))
         os.remove(cfile1)
+
     def test_add_function_persistent1(self):
         """ Test persisting a function in the default catalog
         """
@@ -269,7 +300,7 @@
         # any way to clean modules???
         restore_temp_catalog()
         for i in funcs:
-            assert(i in pfuncs)
+            assert_(i in pfuncs)
 
     def test_add_function_ordered(self):
         clear_temp_catalog()
@@ -315,13 +346,13 @@
         # been read in from a prior catalog file (such as the defualt one).
         # the test should really be made so that these aren't read in, but
         # until I get this figured out...
-        #assert(funcs1 == [string.lower,string.upper])
-        #assert(funcs2 == [os.chdir,os.abort,string.replace,string.find])
-        #assert(funcs3 == [re.purge,re.match,os.open,
+        #assert_(funcs1 == [string.lower,string.upper])
+        #assert_(funcs2 == [os.chdir,os.abort,string.replace,string.find])
+        #assert_(funcs3 == [re.purge,re.match,os.open,
         #                  os.access,string.atoi,string.atof])
-        assert(funcs1[:2] == [string.lower,string.upper]),`funcs1`
-        assert(funcs2[:4] == [os.chdir,os.abort,string.replace,string.find])
-        assert(funcs3[:6] == [re.purge,re.match,os.open,
+        assert_(funcs1[:2] == [string.lower,string.upper]),`funcs1`
+        assert_(funcs2[:4] == [os.chdir,os.abort,string.replace,string.find])
+        assert_(funcs3[:6] == [re.purge,re.match,os.open,
                           os.access,string.atoi,string.atof])
         cleanup_temp_dir(user_dir)
         cleanup_temp_dir(env_dir)

Modified: trunk/scipy/weave/tests/test_ext_tools.py
===================================================================
--- trunk/scipy/weave/tests/test_ext_tools.py	2010-10-01 10:23:34 UTC (rev 6828)
+++ trunk/scipy/weave/tests/test_ext_tools.py	2010-10-10 04:40:47 UTC (rev 6829)
@@ -1,25 +1,28 @@
-import nose
-from numpy.testing import *
 
+from numpy.testing import TestCase, dec, assert_equal, assert_
+
 from scipy.weave import ext_tools, c_spec
 try:
     from scipy.weave.standard_array_spec import array_converter
 except ImportError:
     pass # requires numpy.numerix
 
+from weave_test_utils import empty_temp_dir
 
-from weave_test_utils import *
-
 build_dir = empty_temp_dir()
 
+
 class TestExtModule(TestCase):
+
     #should really do some testing of where modules end up
+
     @dec.slow
     def test_simple(self):
         """ Simplest possible module """
         mod = ext_tools.ext_module('simple_ext_module')
         mod.compile(location = build_dir)
         import simple_ext_module
+
     @dec.slow
     def test_multi_functions(self):
         mod = ext_tools.ext_module('module_multi_function')
@@ -33,6 +36,7 @@
         import module_multi_function
         module_multi_function.test()
         module_multi_function.test2()
+
     @dec.slow
     def test_with_include(self):
         # decalaring variables
@@ -72,7 +76,7 @@
         mod.compile(location = build_dir)
         import ext_string_and_int
         c = ext_string_and_int.test(a,b)
-        assert(c == len(b))
+        assert_(c == len(b))
 
     @dec.slow
     def test_return_tuple(self):
@@ -94,10 +98,13 @@
         mod.compile(location = build_dir)
         import ext_return_tuple
         c,d = ext_return_tuple.test(a)
-        assert(c==a and d == a+1)
+        assert_(c==a and d == a+1)
 
+
 class TestExtFunction(TestCase):
+
     #should really do some testing of where modules end up
+
     @dec.slow
     def test_simple(self):
         """ Simplest possible function """
@@ -110,7 +117,9 @@
         import simple_ext_function
         simple_ext_function.test()
 
+
 class TestAssignVariableTypes(TestCase):
+
     def test_assign_variable_types(self):
         try:
             from numpy.numerix import arange, Float32, Float64
@@ -136,6 +145,7 @@
         desired = [ad,bd,cd]
         assert_equal(actual,desired)
 
+
 if __name__ == "__main__":
     import nose
     nose.run(argv=['', __file__])

Modified: trunk/scipy/weave/tests/test_inline_tools.py
===================================================================
--- trunk/scipy/weave/tests/test_inline_tools.py	2010-10-01 10:23:34 UTC (rev 6828)
+++ trunk/scipy/weave/tests/test_inline_tools.py	2010-10-10 04:40:47 UTC (rev 6829)
@@ -1,8 +1,9 @@
-from numpy import *
-from numpy.testing import *
 
+from numpy.testing import TestCase, dec, assert_
+
 from scipy.weave import inline_tools
 
+
 class TestInline(TestCase):
     """ These are long running tests...
 
@@ -19,7 +20,7 @@
                    return_val = PyInt_FromLong(a+1);
                """
         result = inline_tools.inline(code,['a'])
-        assert(result == 4)
+        assert_(result == 4)
 
 ## Unfortunately, it is not always possible to catch distutils compiler
 ## errors, since SystemExit is used.  Until that is fixed, these tests
@@ -28,7 +29,7 @@
 ##         try:
 ##             a = 1
 ##             result = inline_tools.inline(code,['a'])
-##             assert(1) # should've thrown a ValueError
+##             assert_(1) # should've thrown a ValueError
 ##         except ValueError:
 ##             pass
 
@@ -36,7 +37,7 @@
 ##         try:
 ##             a = 'string'
 ##             result = inline_tools.inline(code,['a'])
-##             assert(1) # should've gotten an error
+##             assert_(1) # should've gotten an error
 ##         except:
 ##             # ?CompileError is the error reported, but catching it doesn't work
 ##             pass

Modified: trunk/scipy/weave/tests/test_numpy_scalar_spec.py
===================================================================
--- trunk/scipy/weave/tests/test_numpy_scalar_spec.py	2010-10-01 10:23:34 UTC (rev 6828)
+++ trunk/scipy/weave/tests/test_numpy_scalar_spec.py	2010-10-10 04:40:47 UTC (rev 6829)
@@ -9,7 +9,7 @@
 test_dir = ''
 
 import numpy
-from numpy.testing import *
+from numpy.testing import TestCase, dec, assert_
 
 from scipy.weave import inline_tools,ext_tools
 from scipy.weave.build_tools import msvc_exists, gcc_exists
@@ -33,6 +33,7 @@
 #----------------------------------------------------------------------------
 
 class NumpyComplexScalarConverter(TestCase):
+
     compiler = ''
 
     def setUp(self):
@@ -40,16 +41,19 @@
 
     @dec.slow
     def test_type_match_string(self):
-        assert( not self.converter.type_match('string') )
+        assert_( not self.converter.type_match('string') )
+
     @dec.slow
     def test_type_match_int(self):
-        assert( not self.converter.type_match(5))
+        assert_( not self.converter.type_match(5))
+
     @dec.slow
     def test_type_match_float(self):
-        assert( not self.converter.type_match(5.))
+        assert_( not self.converter.type_match(5.))
+
     @dec.slow
     def test_type_match_complex128(self):
-        assert(self.converter.type_match(numpy.complex128(5.+1j)))
+        assert_(self.converter.type_match(numpy.complex128(5.+1j)))
 
     @dec.slow
     def test_complex_var_in(self):
@@ -91,13 +95,13 @@
         exec 'from ' + mod_name + ' import test'
         b=1.+1j
         c = test(b)
-        assert( c == 3.+3j)
+        assert_( c == 3.+3j)
 
     @dec.slow
     def test_inline(self):
         a = numpy.complex128(1+1j)
         result = inline_tools.inline("return_val=1.0/a;",['a'])
-        assert( result==.5-.5j)
+        assert_( result==.5-.5j)
 
 # class TestMsvcNumpyComplexScalarConverter(
 #                   TestNumpyComplexScalarConverter):
@@ -150,6 +154,7 @@
     for _n in dir():
         if _n[:7]=='TestGcc': exec 'del '+_n
 
+
 if __name__ == "__main__":
     import nose
     nose.run(argv=['', __file__])

Modified: trunk/scipy/weave/tests/test_scxx_dict.py
===================================================================
--- trunk/scipy/weave/tests/test_scxx_dict.py	2010-10-01 10:23:34 UTC (rev 6828)
+++ trunk/scipy/weave/tests/test_scxx_dict.py	2010-10-10 04:40:47 UTC (rev 6829)
@@ -3,7 +3,7 @@
 
 import sys
 
-from numpy.testing import *
+from numpy.testing import TestCase, dec, assert_, assert_raises
 
 from scipy.weave import inline_tools
 
@@ -21,11 +21,12 @@
                return_val = val;
                """
         res = inline_tools.inline(code)
-        assert sys.getrefcount(res) == 2
-        assert res == {}
+        assert_(sys.getrefcount(res) == 2)
+        assert_(res == {})
 
 
 class TestDictHasKey(TestCase):
+
     @dec.slow
     def test_obj(self):
         class Foo:
@@ -37,7 +38,8 @@
                return_val =  a.has_key(key);
                """
         res = inline_tools.inline(code,['a','key'])
-        assert res
+        assert_(res)
+
     @dec.slow
     def test_int(self):
         a = {}
@@ -46,7 +48,8 @@
                return_val = a.has_key(1234);
                """
         res = inline_tools.inline(code,['a'])
-        assert res
+        assert_(res)
+
     @dec.slow
     def test_double(self):
         a = {}
@@ -55,7 +58,8 @@
                return_val = a.has_key(1234.);
                """
         res = inline_tools.inline(code,['a'])
-        assert res
+        assert_(res)
+
     @dec.slow
     def test_complex(self):
         a = {}
@@ -65,7 +69,7 @@
                return_val = a.has_key(key);
                """
         res = inline_tools.inline(code,['a','key'])
-        assert res
+        assert_(res)
 
     @dec.slow
     def test_string(self):
@@ -75,7 +79,8 @@
                return_val = a.has_key("b");
                """
         res = inline_tools.inline(code,['a'])
-        assert res
+        assert_(res)
+
     @dec.slow
     def test_std_string(self):
         a = {}
@@ -85,7 +90,8 @@
                return_val = a.has_key(key_name);
                """
         res = inline_tools.inline(code,['a','key_name'])
-        assert res
+        assert_(res)
+
     @dec.slow
     def test_string_fail(self):
         a = {}
@@ -94,8 +100,9 @@
                return_val = a.has_key("c");
                """
         res = inline_tools.inline(code,['a'])
-        assert not res
+        assert_(not res)
 
+
 class TestDictGetItemOp(TestCase):
 
     def generic_get(self,code,args=['a']):
@@ -103,7 +110,7 @@
         a['b'] = 12345
 
         res = inline_tools.inline(code,args)
-        assert res == a['b']
+        assert_(res == a['b'])
 
     @dec.slow
     def test_char(self):
@@ -114,10 +121,7 @@
     def test_char_fail(self):
         # We can't through a KeyError for dicts on RHS of
         # = but not on LHS.  Not sure how to deal with this.
-        try:
-            self.generic_get('return_val = a["c"];')
-        except KeyError:
-            pass
+        assert_raises(KeyError, self.generic_get, 'return_val = a["c"];')
 
     @dec.slow
     def test_string(self):
@@ -137,16 +141,15 @@
     def test_obj_fail(self):
         # We can't through a KeyError for dicts on RHS of
         # = but not on LHS.  Not sure how to deal with this.
-        try:
-            code = """
-                   py::object name = "c";
-                   return_val = a[name];
-                   """
-            self.generic_get(code,['a'])
-        except KeyError:
-            pass
+        code = """
+               py::object name = "c";
+               return_val = a[name];
+               """
+        assert_raises(KeyError, self.generic_get, code, ['a'])
 
+
 class TestDictSetOperator(TestCase):
+
     def generic_new(self,key,val):
         # test that value is set correctly and that reference counts
         # on dict, key, and val are being handled correctly.
@@ -154,12 +157,13 @@
         # call once to handle mysterious addition of one ref count
         # on first call to inline.
         inline_tools.inline("a[key] = val;",['a','key','val'])
-        assert a[key] == val
+        assert_(a[key] == val)
         before = sys.getrefcount(a), sys.getrefcount(key), sys.getrefcount(val)
         inline_tools.inline("a[key] = val;",['a','key','val'])
-        assert a[key] == val
+        assert_(a[key] == val)
         after = sys.getrefcount(a), sys.getrefcount(key), sys.getrefcount(val)
-        assert before == after
+        assert_(before == after)
+
     def generic_overwrite(self,key,val):
         a = {}
         overwritten = 1
@@ -168,31 +172,35 @@
         # on first call to inline.
         before_overwritten = sys.getrefcount(overwritten)
         inline_tools.inline("a[key] = val;",['a','key','val'])
-        assert a[key] == val
+        assert_(a[key] == val)
         before = sys.getrefcount(a), sys.getrefcount(key), sys.getrefcount(val)
         inline_tools.inline("a[key] = val;",['a','key','val'])
-        assert a[key] == val
+        assert_(a[key] == val)
         after = sys.getrefcount(a), sys.getrefcount(key), sys.getrefcount(val)
         after_overwritten = sys.getrefcount(overwritten)
-        assert before == after
-        assert before_overwritten == after_overwritten
+        assert_(before == after)
+        assert_(before_overwritten == after_overwritten)
 
     @dec.slow
     def test_new_int_int(self):
         key,val = 1234,12345
         self.generic_new(key,val)
+
     @dec.slow
     def test_new_double_int(self):
         key,val = 1234.,12345
         self.generic_new(key,val)
+
     @dec.slow
     def test_new_std_string_int(self):
         key,val = "hello",12345
         self.generic_new(key,val)
+
     @dec.slow
     def test_new_complex_int(self):
         key,val = 1+1j,12345
         self.generic_new(key,val)
+
     @dec.slow
     def test_new_obj_int(self):
         class Foo:
@@ -204,18 +212,22 @@
     def test_overwrite_int_int(self):
         key,val = 1234,12345
         self.generic_overwrite(key,val)
+
     @dec.slow
     def test_overwrite_double_int(self):
         key,val = 1234.,12345
         self.generic_overwrite(key,val)
+
     @dec.slow
     def test_overwrite_std_string_int(self):
         key,val = "hello",12345
         self.generic_overwrite(key,val)
+
     @dec.slow
     def test_overwrite_complex_int(self):
         key,val = 1+1j,12345
         self.generic_overwrite(key,val)
+
     @dec.slow
     def test_overwrite_obj_int(self):
         class Foo:
@@ -223,7 +235,9 @@
         key,val = Foo(),12345
         self.generic_overwrite(key,val)
 
+
 class TestDictDel(TestCase):
+
     def generic(self,key):
         # test that value is set correctly and that reference counts
         # on dict, key, are being handled correctly. after deletion,
@@ -231,30 +245,35 @@
         a = {}
         a[key] = 1
         inline_tools.inline("a.del(key);",['a','key'])
-        assert key not in a
+        assert_(key not in a)
         a[key] = 1
         before = sys.getrefcount(a), sys.getrefcount(key)
         inline_tools.inline("a.del(key);",['a','key'])
-        assert key not in a
+        assert_(key not in a)
         after = sys.getrefcount(a), sys.getrefcount(key)
-        assert before[0] == after[0]
-        assert before[1] == after[1] + 1
+        assert_(before[0] == after[0])
+        assert_(before[1] == after[1] + 1)
+
     @dec.slow
     def test_int(self):
         key = 1234
         self.generic(key)
+
     @dec.slow
     def test_double(self):
         key = 1234.
         self.generic(key)
+
     @dec.slow
     def test_std_string(self):
         key = "hello"
         self.generic(key)
+
     @dec.slow
     def test_complex(self):
         key = 1+1j
         self.generic(key)
+
     @dec.slow
     def test_obj(self):
         class Foo:
@@ -262,39 +281,46 @@
         key = Foo()
         self.generic(key)
 
+
 class TestDictOthers(TestCase):
+
     @dec.slow
     def test_clear(self):
         a = {}
         a["hello"] = 1
         inline_tools.inline("a.clear();",['a'])
-        assert not a
+        assert_(not a)
+
     @dec.slow
     def test_items(self):
         a = {}
         a["hello"] = 1
         items = inline_tools.inline("return_val = a.items();",['a'])
-        assert items == a.items()
+        assert_(items == a.items())
+
     @dec.slow
     def test_values(self):
         a = {}
         a["hello"] = 1
         values = inline_tools.inline("return_val = a.values();",['a'])
-        assert values == a.values()
+        assert_(values == a.values())
+
     @dec.slow
     def test_keys(self):
         a = {}
         a["hello"] = 1
         keys = inline_tools.inline("return_val = a.keys();",['a'])
-        assert keys == a.keys()
+        assert_(keys == a.keys())
+
     @dec.slow
     def test_update(self):
         a,b = {},{}
         a["hello"] = 1
         b["hello"] = 2
         inline_tools.inline("a.update(b);",['a','b'])
-        assert a == b
+        assert_(a == b)
 
+
 if __name__ == "__main__":
     import nose
     nose.run(argv=['', __file__])

Modified: trunk/scipy/weave/tests/test_scxx_object.py
===================================================================
--- trunk/scipy/weave/tests/test_scxx_object.py	2010-10-01 10:23:34 UTC (rev 6828)
+++ trunk/scipy/weave/tests/test_scxx_object.py	2010-10-10 04:40:47 UTC (rev 6829)
@@ -3,8 +3,7 @@
 
 import sys
 
-import nose
-from numpy.testing import *
+from numpy.testing import TestCase, dec, assert_equal, assert_, assert_raises
 
 from scipy.weave import inline_tools
 
@@ -14,6 +13,7 @@
     # Check that construction from basic types is allowed and have correct
     # reference counts
     #------------------------------------------------------------------------
+
     @dec.slow
     def test_int(self):
         # strange int value used to try and make sure refcount is 2.
@@ -24,6 +24,7 @@
         res = inline_tools.inline(code)
         assert_equal(sys.getrefcount(res),2)
         assert_equal(res,1001)
+
     @dec.slow
     def test_float(self):
         code = """
@@ -33,6 +34,7 @@
         res = inline_tools.inline(code)
         assert_equal(sys.getrefcount(res),2)
         assert_equal(res,1.0)
+
     @dec.slow
     def test_double(self):
         code = """
@@ -42,6 +44,7 @@
         res = inline_tools.inline(code)
         assert_equal(sys.getrefcount(res),2)
         assert_equal(res,1.0)
+
     @dec.slow
     def test_complex(self):
         code = """
@@ -52,6 +55,7 @@
         res = inline_tools.inline(code)
         assert_equal(sys.getrefcount(res),2)
         assert_equal(res,1.0+1.0j)
+
     @dec.slow
     def test_string(self):
         code = """
@@ -77,6 +81,7 @@
     #------------------------------------------------------------------------
     # Check the object print protocol.
     #------------------------------------------------------------------------
+
     @dec.slow
     def test_stringio(self):
         import cStringIO
@@ -104,6 +109,7 @@
 
 
 class TestObjectCast(TestCase):
+
     @dec.slow
     def test_int_cast(self):
         code = """
@@ -111,6 +117,7 @@
                int raw_val __attribute__ ((unused)) = val;
                """
         inline_tools.inline(code)
+
     @dec.slow
     def test_double_cast(self):
         code = """
@@ -118,6 +125,7 @@
                double raw_val __attribute__ ((unused)) = val;
                """
         inline_tools.inline(code)
+
     @dec.slow
     def test_float_cast(self):
         code = """
@@ -125,6 +133,7 @@
                float raw_val __attribute__ ((unused)) = val;
                """
         inline_tools.inline(code)
+
     @dec.slow
     def test_complex_cast(self):
         code = """
@@ -133,6 +142,7 @@
                std::complex<double> raw_val __attribute__ ((unused)) = val;
                """
         inline_tools.inline(code)
+
     @dec.slow
     def test_string_cast(self):
         code = """
@@ -141,6 +151,7 @@
                """
         inline_tools.inline(code)
 
+
 # test class used for testing python class access from C++.
 class Foo:
     def bar(self):
@@ -154,7 +165,9 @@
 #    def __str__(self):
 #        return "b"
 
+
 class TestObjectHasattr(TestCase):
+
     @dec.slow
     def test_string(self):
         a = Foo()
@@ -163,7 +176,8 @@
                return_val = a.hasattr("b");
                """
         res = inline_tools.inline(code,['a'])
-        assert res
+        assert_(res)
+
     @dec.slow
     def test_std_string(self):
         a = Foo()
@@ -173,7 +187,8 @@
                return_val = a.hasattr(attr_name);
                """
         res = inline_tools.inline(code,['a','attr_name'])
-        assert res
+        assert_(res)
+
     @dec.slow
     def test_string_fail(self):
         a = Foo()
@@ -182,7 +197,8 @@
                return_val = a.hasattr("c");
                """
         res = inline_tools.inline(code,['a'])
-        assert not res
+        assert_(not res)
+
     @dec.slow
     def test_inline(self):
         """ THIS NEEDS TO MOVE TO THE INLINE TEST SUITE
@@ -213,8 +229,9 @@
                return_val = a.hasattr("bar");
                """
         res = inline_tools.inline(code,['a'])
-        assert res
+        assert_(res)
 
+
 class TestObjectAttr(TestCase):
 
     def generic_attr(self,code,args=['a']):
@@ -234,10 +251,7 @@
 
     @dec.slow
     def test_char_fail(self):
-        try:
-            self.generic_attr('return_val = a.attr("c");')
-        except AttributeError:
-            pass
+        assert_raises(AttributeError, self.generic_attr, 'return_val = a.attr("c");')
 
     @dec.slow
     def test_string(self):
@@ -245,10 +259,7 @@
 
     @dec.slow
     def test_string_fail(self):
-        try:
-            self.generic_attr('return_val = a.attr(std::string("c"));')
-        except AttributeError:
-            pass
+        assert_raises(AttributeError, self.generic_attr, 'return_val = a.attr(std::string("c"));')
 
     @dec.slow
     def test_obj(self):
@@ -260,14 +271,11 @@
 
     @dec.slow
     def test_obj_fail(self):
-        try:
-            code = """
-                   py::object name = "c";
-                   return_val = a.attr(name);
-                   """
-            self.generic_attr(code,['a'])
-        except AttributeError:
-            pass
+        code = """
+               py::object name = "c";
+               return_val = a.attr(name);
+               """
+        assert_raises(AttributeError, self.generic_attr, code, ['a'])
 
     @dec.slow
     def test_attr_call(self):
@@ -280,6 +288,7 @@
         assert_equal(res,"bar results")
         assert_equal(first,second)
 
+
 class TestObjectSetAttr(TestCase):
 
     def generic_existing(self, code, desired):
@@ -298,15 +307,19 @@
     @dec.slow
     def test_existing_char(self):
         self.generic_existing('a.set_attr("b","hello");',"hello")
+
     @dec.slow
     def test_new_char(self):
         self.generic_new('a.set_attr("b","hello");',"hello")
+
     @dec.slow
     def test_existing_string(self):
         self.generic_existing('a.set_attr("b",std::string("hello"));',"hello")
+
     @dec.slow
     def test_new_string(self):
         self.generic_new('a.set_attr("b",std::string("hello"));',"hello")
+
     @dec.slow
     def test_existing_object(self):
         code = """
@@ -314,6 +327,7 @@
                a.set_attr("b",obj);
                """
         self.generic_existing(code,"hello")
+
     @dec.slow
     def test_new_object(self):
         code = """
@@ -321,6 +335,7 @@
                a.set_attr("b",obj);
                """
         self.generic_new(code,"hello")
+
     @dec.slow
     def test_new_fail(self):
         try:
@@ -335,9 +350,11 @@
     @dec.slow
     def test_existing_int(self):
         self.generic_existing('a.set_attr("b",1);',1)
+
     @dec.slow
     def test_existing_double(self):
         self.generic_existing('a.set_attr("b",1.0);',1.0)
+
     @dec.slow
     def test_existing_complex(self):
         code = """
@@ -345,9 +362,11 @@
                a.set_attr("b",obj);
                """
         self.generic_existing(code,1+1j)
+
     @dec.slow
     def test_existing_char1(self):
         self.generic_existing('a.set_attr("b","hello");',"hello")
+
     @dec.slow
     def test_existing_string1(self):
         code = """
@@ -356,17 +375,20 @@
                """
         self.generic_existing(code,"hello")
 
+
 class TestObjectDel(TestCase):
+
     def generic(self, code):
         args = ['a']
         a = Foo()
         a.b = 12345
         res = inline_tools.inline(code,args)
-        assert not hasattr(a,"b")
+        assert_(not hasattr(a,"b"))
 
     @dec.slow
     def test_char(self):
         self.generic('a.del("b");')
+
     @dec.slow
     def test_string(self):
         code = """
@@ -374,6 +396,7 @@
                a.del(name);
                """
         self.generic(code)
+
     @dec.slow
     def test_object(self):
         code = """
@@ -382,12 +405,15 @@
                """
         self.generic(code)
 
+
 class TestObjectCmp(TestCase):
+
     @dec.slow
     def test_equal(self):
         a,b = 1,1
         res = inline_tools.inline('return_val = (a == b);',['a','b'])
         assert_equal(res,(a == b))
+
     @dec.slow
     def test_equal_objects(self):
         class Foo:
@@ -398,56 +424,67 @@
         a,b = Foo(1),Foo(2)
         res = inline_tools.inline('return_val = (a == b);',['a','b'])
         assert_equal(res,(a == b))
+
     @dec.slow
     def test_lt(self):
         a,b = 1,2
         res = inline_tools.inline('return_val = (a < b);',['a','b'])
         assert_equal(res,(a < b))
+
     @dec.slow
     def test_gt(self):
         a,b = 1,2
         res = inline_tools.inline('return_val = (a > b);',['a','b'])
         assert_equal(res,(a > b))
+
     @dec.slow
     def test_gte(self):
         a,b = 1,2
         res = inline_tools.inline('return_val = (a >= b);',['a','b'])
         assert_equal(res,(a >= b))
+
     @dec.slow
     def test_lte(self):
         a,b = 1,2
         res = inline_tools.inline('return_val = (a <= b);',['a','b'])
         assert_equal(res,(a <= b))
+
     @dec.slow
     def test_not_equal(self):
         a,b = 1,2
         res = inline_tools.inline('return_val = (a != b);',['a','b'])
         assert_equal(res,(a != b))
+
     @dec.slow
     def test_int(self):
         a = 1
         res = inline_tools.inline('return_val = (a == 1);',['a'])
         assert_equal(res,(a == 1))
+
     @dec.slow
     def test_int2(self):
         a = 1
         res = inline_tools.inline('return_val = (1 == a);',['a'])
         assert_equal(res,(a == 1))
+
     @dec.slow
     def test_unsigned_long(self):
         a = 1
         res = inline_tools.inline('return_val = (a == (unsigned long)1);',['a'])
         assert_equal(res,(a == 1))
+
     @dec.slow
     def test_double(self):
         a = 1
         res = inline_tools.inline('return_val = (a == 1.0);',['a'])
         assert_equal(res,(a == 1.0))
+
     @dec.slow
     def test_char(self):
         a = "hello"
         res = inline_tools.inline('return_val = (a == "hello");',['a'])
         assert_equal(res,(a == "hello"))
+
     @dec.slow
     def test_std_string(self):
         a = "hello"
@@ -458,7 +495,9 @@
         res = inline_tools.inline(code,['a'])
         assert_equal(res,(a == "hello"))
 
+
 class TestObjectRepr(TestCase):
+
     @dec.slow
     def test_repr(self):
         class Foo:
@@ -475,7 +514,9 @@
         assert_equal(first,second)
         assert_equal(res,"repr return")
 
+
 class TestObjectStr(TestCase):
+
     @dec.slow
     def test_str(self):
         class Foo:
@@ -493,8 +534,11 @@
         print res
         assert_equal(res,"str return")
 
+
 class TestObjectUnicode(TestCase):
+
     # This ain't going to win awards for test of the year...
+
     @dec.slow
     def test_unicode(self):
         class Foo:
@@ -511,7 +555,9 @@
         assert_equal(first,second)
         assert_equal(res,"unicode")
 
+
 class TestObjectIsCallable(TestCase):
+
     @dec.slow
     def test_true(self):
         class Foo:
@@ -519,16 +565,19 @@
                 return 0
         a= Foo()
         res = inline_tools.inline('return_val = a.is_callable();',['a'])
-        assert res
+        assert_(res)
+
     @dec.slow
     def test_false(self):
         class Foo:
             pass
         a= Foo()
         res = inline_tools.inline('return_val = a.is_callable();',['a'])
-        assert not res
+        assert_(not res)
 
+
 class TestObjectCall(TestCase):
+
     @dec.slow
     def test_noargs(self):
         def Foo():
@@ -536,6 +585,7 @@
         res = inline_tools.inline('return_val = Foo.call();',['Foo'])
         assert_equal(res,(1,2,3))
         assert_equal(sys.getrefcount(res),3) # should be 2?
+
     @dec.slow
     def test_args(self):
         def Foo(val1,val2):
@@ -549,6 +599,7 @@
         res = inline_tools.inline(code,['Foo'])
         assert_equal(res,(1,"hello"))
         assert_equal(sys.getrefcount(res),2)
+
     @dec.slow
     def test_args_kw(self):
         def Foo(val1,val2,val3=1):
@@ -564,6 +615,7 @@
         res = inline_tools.inline(code,['Foo'])
         assert_equal(res,(1,"hello",3))
         assert_equal(sys.getrefcount(res),2)
+
     @dec.slow
     def test_noargs_with_args(self):
         # calling a function that does take args with args
@@ -588,7 +640,9 @@
         # first should == second, but the weird refcount error
         assert_equal(second,third)
 
+
 class TestObjectMcall(TestCase):
+
     @dec.slow
     def test_noargs(self):
         a = Foo()
@@ -600,6 +654,7 @@
         assert_equal(res,"bar results")
         second = sys.getrefcount(res)
         assert_equal(first,second)
+
     @dec.slow
     def test_args(self):
         a = Foo()
@@ -612,6 +667,7 @@
         res = inline_tools.inline(code,['a'])
         assert_equal(res,(1,"hello"))
         assert_equal(sys.getrefcount(res),2)
+
     @dec.slow
     def test_args_kw(self):
         a = Foo()
@@ -626,6 +682,7 @@
         res = inline_tools.inline(code,['a'])
         assert_equal(res,(1,"hello",3))
         assert_equal(sys.getrefcount(res),2)
+
     @dec.slow
     def test_std_noargs(self):
         a = Foo()
@@ -638,6 +695,7 @@
         assert_equal(res,"bar results")
         second = sys.getrefcount(res)
         assert_equal(first,second)
+
     @dec.slow
     def test_std_args(self):
         a = Foo()
@@ -651,6 +709,7 @@
         res = inline_tools.inline(code,['a','method'])
         assert_equal(res,(1,"hello"))
         assert_equal(sys.getrefcount(res),2)
+
     @dec.slow
     def test_std_args_kw(self):
         a = Foo()
@@ -666,6 +725,7 @@
         res = inline_tools.inline(code,['a','method'])
         assert_equal(res,(1,"hello",3))
         assert_equal(sys.getrefcount(res),2)
+
     @dec.slow
     def test_noargs_with_args(self):
         # calling a function that does take args with args
@@ -689,7 +749,9 @@
         # first should == second, but the weird refcount error
         assert_equal(second,third)
 
+
 class TestObjectHash(TestCase):
+
     @dec.slow
     def test_hash(self):
         class Foo:
@@ -700,7 +762,9 @@
         print 'hash:', res
         assert_equal(res,123)
 
+
 class TestObjectIsTrue(TestCase):
+
     @dec.slow
     def test_true(self):
         class Foo:
@@ -708,13 +772,16 @@
         a= Foo()
         res = inline_tools.inline('return_val = a.is_true();',['a'])
         assert_equal(res,1)
+
     @dec.slow
     def test_false(self):
         a= None
         res = inline_tools.inline('return_val = a.is_true();',['a'])
         assert_equal(res,0)
 
+
 class TestObjectType(TestCase):
+
     @dec.slow
     def test_type(self):
         class Foo:
@@ -723,7 +790,9 @@
         res = inline_tools.inline('return_val = a.type();',['a'])
         assert_equal(res,type(a))
 
+
 class TestObjectSize(TestCase):
+
     @dec.slow
     def test_size(self):
         class Foo:
@@ -732,6 +801,7 @@
         a= Foo()
         res = inline_tools.inline('return_val = a.size();',['a'])
         assert_equal(res,len(a))
+
     @dec.slow
     def test_len(self):
         class Foo:
@@ -740,6 +810,7 @@
         a= Foo()
         res = inline_tools.inline('return_val = a.len();',['a'])
         assert_equal(res,len(a))
+
     @dec.slow
     def test_length(self):
         class Foo:
@@ -749,8 +820,12 @@
         res = inline_tools.inline('return_val = a.length();',['a'])
         assert_equal(res,len(a))
 
+
 from UserList import UserList
+
+
 class TestObjectSetItemOpIndex(TestCase):
+
     @dec.slow
     def test_list_refcount(self):
         a = UserList([1,2,3])
@@ -759,39 +834,48 @@
         before1 = sys.getrefcount(a)
         after1 = sys.getrefcount(a)
         assert_equal(after1,before1)
+
     @dec.slow
     def test_set_int(self):
         a = UserList([1,2,3])
         inline_tools.inline("a[1] = 1234;",['a'])
         assert_equal(sys.getrefcount(a[1]),2)
         assert_equal(a[1],1234)
+
     @dec.slow
     def test_set_double(self):
         a = UserList([1,2,3])
         inline_tools.inline("a[1] = 123.0;",['a'])
         assert_equal(sys.getrefcount(a[1]),2)
         assert_equal(a[1],123.0)
+
     @dec.slow
     def test_set_char(self):
         a = UserList([1,2,3])
         inline_tools.inline('a[1] = "bubba";',['a'])
         assert_equal(sys.getrefcount(a[1]),2)
         assert_equal(a[1],'bubba')
+
     @dec.slow
-    def test_set_string(self):
+    def test_set_string1(self):
         a = UserList([1,2,3])
         inline_tools.inline('a[1] = std::string("sissy");',['a'])
         assert_equal(sys.getrefcount(a[1]),2)
         assert_equal(a[1],'sissy')
+
     @dec.slow
-    def test_set_string(self):
+    def test_set_string2(self):
         a = UserList([1,2,3])
         inline_tools.inline('a[1] = std::complex<double>(1,1);',['a'])
         assert_equal(sys.getrefcount(a[1]),2)
         assert_equal(a[1],1+1j)
 
+
 from UserDict import UserDict
+
+
 class TestObjectSetItemOpKey(TestCase):
+
     @dec.slow
     def test_key_refcount(self):
         a = UserDict()
@@ -841,6 +925,7 @@
         assert_equal(sys.getrefcount(key),5)
         assert_equal(sys.getrefcount(a[key]),2)
         assert_equal(a[key],123.0)
+
     @dec.slow
     def test_set_double_new(self):
         a = UserDict()
@@ -849,6 +934,7 @@
         assert_equal(sys.getrefcount(key),4) # should be 3
         assert_equal(sys.getrefcount(a[key]),2)
         assert_equal(a[key],123.0)
+
     @dec.slow
     def test_set_complex(self):
         a = UserDict()
@@ -857,6 +943,7 @@
         assert_equal(sys.getrefcount(key),4) # should be 3
         assert_equal(sys.getrefcount(a[key]),2)
         assert_equal(a[key],1234)
+
     @dec.slow
     def test_set_char(self):
         a = UserDict()
@@ -883,6 +970,7 @@
         assert_equal(sys.getrefcount(key),4)
         assert_equal(sys.getrefcount(a[key]),2)
         assert_equal(a[key],'bubba')
+
     @dec.slow
     def test_set_from_member(self):
         a = UserDict()
@@ -891,6 +979,7 @@
         inline_tools.inline('a["first"] = a["second"];',['a'])
         assert_equal(a['first'],a['second'])
 
+
 if __name__ == "__main__":
     import nose
     nose.run(argv=['', __file__])

Modified: trunk/scipy/weave/tests/test_scxx_sequence.py
===================================================================
--- trunk/scipy/weave/tests/test_scxx_sequence.py	2010-10-01 10:23:34 UTC (rev 6828)
+++ trunk/scipy/weave/tests/test_scxx_sequence.py	2010-10-10 04:40:47 UTC (rev 6829)
@@ -4,7 +4,7 @@
 import time
 import sys
 
-from numpy.testing import *
+from numpy.testing import TestCase, dec, assert_, assert_raises
 
 from scipy.weave import inline_tools
 
@@ -18,6 +18,7 @@
 #     operator[] (get)
 #     operator[] (set)  DONE
 
+
 class _TestSequenceBase(TestCase):
     seq_type = None
 
@@ -32,7 +33,7 @@
         inline_tools.inline(" ",['a'])
         after = sys.getrefcount(a)
         #print '2nd,3rd:', before, after
-        assert(after == before)
+        assert_(after == before)
 
     @dec.slow
     def test_in(self):
@@ -44,34 +45,34 @@
         item = 1
         code = "return_val = a.in(item);"
         res = inline_tools.inline(code,['a','item'])
-        assert res == 1
+        assert_(res == 1)
         item = 0
         res = inline_tools.inline(code,['a','item'])
-        assert res == 0
+        assert_(res == 0)
 
         # check overloaded in(int val) method
         code = "return_val = a.in(1);"
         res = inline_tools.inline(code,['a'])
-        assert res == 1
+        assert_(res == 1)
         code = "return_val = a.in(0);"
         res = inline_tools.inline(code,['a'])
-        assert res == 0
+        assert_(res == 0)
 
         # check overloaded in(double val) method
         code = "return_val = a.in(3.1416);"
         res = inline_tools.inline(code,['a'])
-        assert res == 1
+        assert_(res == 1)
         code = "return_val = a.in(3.1417);"
         res = inline_tools.inline(code,['a'])
-        assert res == 0
+        assert_(res == 0)
 
         # check overloaded in(char* val) method
         code = 'return_val = a.in("alpha");'
         res = inline_tools.inline(code,['a'])
-        assert res == 1
+        assert_(res == 1)
         code = 'return_val = a.in("beta");'
         res = inline_tools.inline(code,['a'])
-        assert res == 0
+        assert_(res == 0)
 
         # check overloaded in(std::string val) method
         code = """
@@ -79,13 +80,13 @@
                return_val = a.in(val);
                """
         res = inline_tools.inline(code,['a'])
-        assert res == 1
+        assert_(res == 1)
         code = """
                std::string val = std::string("beta");
                return_val = a.in(val);
                """
         res = inline_tools.inline(code,['a'])
-        assert res == 0
+        assert_(res == 0)
 
     @dec.slow
     def test_count(self):
@@ -97,22 +98,22 @@
         item = 1
         code = "return_val = a.count(item);"
         res = inline_tools.inline(code,['a','item'])
-        assert res == 1
+        assert_(res == 1)
 
         # check overloaded count(int val) method
         code = "return_val = a.count(1);"
         res = inline_tools.inline(code,['a'])
-        assert res == 1
+        assert_(res == 1)
 
         # check overloaded count(double val) method
         code = "return_val = a.count(3.1416);"
         res = inline_tools.inline(code,['a'])
-        assert res == 1
+        assert_(res == 1)
 
         # check overloaded count(char* val) method
         code = 'return_val = a.count("alpha");'
         res = inline_tools.inline(code,['a'])
-        assert res == 1
+        assert_(res == 1)
 
         # check overloaded count(std::string val) method
         code = """
@@ -120,7 +121,7 @@
                return_val = a.count(alpha);
                """
         res = inline_tools.inline(code,['a'])
-        assert res == 1
+        assert_(res == 1)
 
     @dec.slow
     def test_access_speed(self):
@@ -179,8 +180,9 @@
         inline_tools.inline(code,['a','b'])
         t2 = time.time()
         print 'weave:', t2 - t1
-        assert list(b) == list(a)
+        assert_(list(b) == list(a))
 
+
 class TestTuple(_TestSequenceBase):
     seq_type = tuple
 
@@ -189,10 +191,8 @@
         # Tuples should only allow setting of variables
         # immediately after creation.
         a = (1,2,3)
-        try:
-            inline_tools.inline("a[1] = 1234;",['a'])
-        except TypeError:
-            pass
+        assert_raises(TypeError, inline_tools.inline, "a[1] = 1234;",['a'])
+
     @dec.slow
     def test_set_item_operator_equal(self):
         code = """
@@ -203,9 +203,9 @@
                return_val = a;
                """
         a = inline_tools.inline(code)
-        assert a == (1,2,3)
+        assert_(a == (1,2,3))
         # returned value should only have a single refcount
-        assert sys.getrefcount(a) == 2
+        assert_(sys.getrefcount(a) == 2)
 
     @dec.slow
     def test_set_item_index_error(self):
@@ -214,25 +214,21 @@
                a[4] = 1;
                return_val = a;
                """
-        try:
-            a = inline_tools.inline(code)
-            assert 0
-        except IndexError:
-            pass
+        assert_raises(IndexError, inline_tools.inline, code)
+
     @dec.slow
     def test_get_item_operator_index_error(self):
         code = """
                py::tuple a(3);
                py::object b = a[4]; // should fail.
                """
-        try:
-            a = inline_tools.inline(code)
-            assert 0
-        except IndexError:
-            pass
+        assert_raises(IndexError, inline_tools.inline, code)
 
+
 class TestList(_TestSequenceBase):
+
     seq_type = list
+
     @dec.slow
     def test_append_passed_item(self):
         a = []
@@ -245,12 +241,13 @@
         before1 = sys.getrefcount(a)
         before2 = sys.getrefcount(item)
         inline_tools.inline("a.append(item);",['a','item'])
-        assert a[0] is item
+        assert_(a[0] is item)
         del a[0]
         after1 = sys.getrefcount(a)
         after2 = sys.getrefcount(item)
-        assert after1 == before1
-        assert after2 == before2
+        assert_(after1 == before1)
+        assert_(after2 == before2)
+
     @dec.slow
     def test_append(self):
         a = []
@@ -262,30 +259,31 @@
 
         # check overloaded append(int val) method
         inline_tools.inline("a.append(1234);",['a'])
-        assert sys.getrefcount(a[0]) == 2
-        assert a[0] == 1234
+        assert_(sys.getrefcount(a[0]) == 2)
+        assert_(a[0] == 1234)
         del a[0]
 
         # check overloaded append(double val) method
         inline_tools.inline("a.append(123.0);",['a'])
-        assert sys.getrefcount(a[0]) == 2
-        assert a[0] == 123.0
+        assert_(sys.getrefcount(a[0]) == 2)
+        assert_(a[0] == 123.0)
         del a[0]
 
         # check overloaded append(char* val) method
         inline_tools.inline('a.append("bubba");',['a'])
-        assert sys.getrefcount(a[0]) == 2
-        assert a[0] == 'bubba'
+        assert_(sys.getrefcount(a[0]) == 2)
+        assert_(a[0] == 'bubba')
         del a[0]
 
         # check overloaded append(std::string val) method
         inline_tools.inline('a.append(std::string("sissy"));',['a'])
-        assert sys.getrefcount(a[0]) == 2
-        assert a[0] == 'sissy'
+        assert_(sys.getrefcount(a[0]) == 2)
+        assert_(a[0] == 'sissy')
         del a[0]
 
         after1 = sys.getrefcount(a)
-        assert after1 == before1
+        assert_(after1 == before1)
+
     @dec.slow
     def test_insert(self):
         a = [1,2,3]
@@ -301,30 +299,30 @@
 
         # check overloaded insert(int ndx, int val) method
         inline_tools.inline("a.insert(1,1234);",['a'])
-        assert sys.getrefcount(a[1]) == 2
-        assert a[1] == 1234
+        assert_(sys.getrefcount(a[1]) == 2)
+        assert_(a[1] == 1234)
         del a[1]
 
         # check overloaded insert(int ndx, double val) method
         inline_tools.inline("a.insert(1,123.0);",['a'])
-        assert sys.getrefcount(a[1]) == 2
-        assert a[1] == 123.0
+        assert_(sys.getrefcount(a[1]) == 2)
+        assert_(a[1] == 123.0)
         del a[1]
 
         # check overloaded insert(int ndx, char* val) method
         inline_tools.inline('a.insert(1,"bubba");',['a'])
-        assert sys.getrefcount(a[1]) == 2
-        assert a[1] == 'bubba'
+        assert_(sys.getrefcount(a[1]) == 2)
+        assert_(a[1] == 'bubba')
         del a[1]
 
         # check overloaded insert(int ndx, std::string val) method
         inline_tools.inline('a.insert(1,std::string("sissy"));',['a'])
-        assert sys.getrefcount(a[1]) == 2
-        assert a[1] == 'sissy'
+        assert_(sys.getrefcount(a[1]) == 2)
+        assert_(a[1] == 'sissy')
         del a[0]
 
         after1 = sys.getrefcount(a)
-        assert after1 == before1
+        assert_(after1 == before1)
 
     @dec.slow
     def test_set_item_operator_equal(self):
@@ -335,18 +333,18 @@
 
         # check overloaded insert(int ndx, int val) method
         inline_tools.inline("a[1] = 1234;",['a'])
-        assert sys.getrefcount(a[1]) == 2
-        assert a[1] == 1234
+        assert_(sys.getrefcount(a[1]) == 2)
+        assert_(a[1] == 1234)
 
         # check overloaded insert(int ndx, double val) method
         inline_tools.inline("a[1] = 123.0;",['a'])
-        assert sys.getrefcount(a[1]) == 2
-        assert a[1] == 123.0
+        assert_(sys.getrefcount(a[1]) == 2)
+        assert_(a[1] == 123.0)
 
         # check overloaded insert(int ndx, char* val) method
         inline_tools.inline('a[1] = "bubba";',['a'])
-        assert sys.getrefcount(a[1]) == 2
-        assert a[1] == 'bubba'
+        assert_(sys.getrefcount(a[1]) == 2)
+        assert_(a[1] == 'bubba')
 
         # check overloaded insert(int ndx, std::string val) method
         code = """
@@ -354,11 +352,12 @@
                a[1] = val;
                """
         inline_tools.inline(code,['a'])
-        assert sys.getrefcount(a[1]) == 2
-        assert a[1] == 'sissy'
+        assert_(sys.getrefcount(a[1]) == 2)
+        assert_(a[1] == 'sissy')
 
         after1 = sys.getrefcount(a)
-        assert after1 == before1
+        assert_(after1 == before1)
+
     @dec.slow
     def test_set_item_operator_equal_created(self):
         code = """
@@ -369,31 +368,25 @@
                return_val = a;
                """
         a = inline_tools.inline(code)
-        assert a == [1,2,3]
+        assert_(a == [1,2,3])
         # returned value should only have a single refcount
-        assert sys.getrefcount(a) == 2
+        assert_(sys.getrefcount(a) == 2)
+
     @dec.slow
     def test_set_item_index_error(self):
         code = """
                py::list a(3);
                a[4] = 1;
                """
-        try:
-            a = inline_tools.inline(code)
-            assert 0
-        except IndexError:
-            pass
+        assert_raises(IndexError, inline_tools.inline, code)
+
     @dec.slow
     def test_get_item_index_error(self):
         code = """
                py::list a(3);
                py::object o = a[4];
                """
-        try:
-            a = inline_tools.inline(code)
-            assert 0
-        except IndexError:
-            pass
+        assert_raises(IndexError, inline_tools.inline, code)
 
     @dec.slow
     def test_string_add_speed(self):
@@ -421,7 +414,8 @@
         inline_tools.inline(code,['a','b'])
         t2 = time.time()
         print 'weave:', t2 - t1
-        assert b == desired
+        assert_(b == desired)
+
     @dec.slow
     def test_int_add_speed(self):
         N = 1000000
@@ -447,8 +441,9 @@
         inline_tools.inline(code,['a','b'])
         t2 = time.time()
         print 'weave:', t2 - t1
-        assert b == desired
+        assert_(b == desired)
 
+
 if __name__ == "__main__":
     import nose
     nose.run(argv=['', __file__])

Modified: trunk/scipy/weave/tests/test_size_check.py
===================================================================
--- trunk/scipy/weave/tests/test_size_check.py	2010-10-01 10:23:34 UTC (rev 6828)
+++ trunk/scipy/weave/tests/test_size_check.py	2010-10-10 04:40:47 UTC (rev 6829)
@@ -1,8 +1,8 @@
 import numpy as np
-from numpy.testing import *
+from numpy.testing import TestCase, assert_array_equal, run_module_suite
 
 from scipy.weave import size_check
-from scipy.weave.ast_tools import *
+from scipy.weave.ast_tools import harvest_variables
 
 empty = np.array(())
 
@@ -316,14 +316,14 @@
         except:
             print 'EXPR:',expr
             print 'ACTUAL:',actual
-            print 'DEISRED:',desired
+            print 'DESIRED:',desired
     def generic_wrap(self,expr,**kw):
         try:
             x = np.array(eval(expr,kw))
             try:
                 desired = x.shape
             except:
-                desired = zeros(())
+                desired = np.zeros(())
         except:
             desired = 'failed'
         self.generic_check(expr,desired,**kw)
@@ -365,5 +365,4 @@
 
 
 if __name__ == "__main__":
-    import nose
     run_module_suite()

Modified: trunk/scipy/weave/tests/test_slice_handler.py
===================================================================
--- trunk/scipy/weave/tests/test_slice_handler.py	2010-10-01 10:23:34 UTC (rev 6828)
+++ trunk/scipy/weave/tests/test_slice_handler.py	2010-10-10 04:40:47 UTC (rev 6829)
@@ -1,9 +1,10 @@
-from numpy.testing import *
+from numpy.testing import TestCase, assert_equal
 
 from scipy.weave import slice_handler
 from scipy.weave.slice_handler import indexed_array_pattern
-from scipy.weave.ast_tools import *
+from scipy.weave.ast_tools import ast_to_string, find_first_pattern
 
+
 class TestBuildSliceAtom(TestCase):
     def generic_check(self,slice_vars,desired):
         pos = slice_vars['pos']
@@ -117,6 +118,7 @@
     return out
 
 class TestTransformSlices(TestCase):
+
     def generic_check(self,suite_string,desired):
         import parser
         ast_list = parser.suite(suite_string).tolist()
@@ -128,12 +130,13 @@
         desired = replace_whitespace(desired)
         assert_equal(actual,desired,suite_string)
 
-    def test_simple_expr(self):
+    def test_simple_expr1(self):
         """transform a[:] to slice notation"""
         test ="a[:]"
-        desired = 'a[slice(_beg,_end,_stp)]'
+        desired = 'a[slice(_beg,_end)]'
         self.generic_check(test,desired)
-    def test_simple_expr(self):
+
+    def test_simple_expr2(self):
         """transform a[:,:] = b[:,1:1+2:3] *(c[1-2+i:,:] - c[:,:])"""
         test ="a[:,:] = b[:,1:1+2:3] *(c[1-2+i:,:] - c[:,:])"
         desired = " a[slice(_beg,_end),slice(_beg,_end)] = "\

Modified: trunk/scipy/weave/tests/test_standard_array_spec.py
===================================================================
--- trunk/scipy/weave/tests/test_standard_array_spec.py	2010-10-01 10:23:34 UTC (rev 6828)
+++ trunk/scipy/weave/tests/test_standard_array_spec.py	2010-10-10 04:40:47 UTC (rev 6829)
@@ -1,5 +1,5 @@
-from numpy import *
-from numpy.testing import *
+from numpy import arange
+from numpy.testing import TestCase, assert_
 
 from scipy.weave import standard_array_spec
 
@@ -9,17 +9,22 @@
     out = out.replace("\n","")
     return out
 
+
 class TestArrayConverter(TestCase):
+
     def test_type_match_string(self):
         s = standard_array_spec.array_converter()
-        assert( not s.type_match('string') )
+        assert_( not s.type_match('string') )
+
     def test_type_match_int(self):
         s = standard_array_spec.array_converter()
-        assert(not s.type_match(5))
+        assert_(not s.type_match(5))
+
     def test_type_match_array(self):
         s = standard_array_spec.array_converter()
-        assert(s.type_match(arange(4)))
+        assert_(s.type_match(arange(4)))
 
+
 if __name__ == "__main__":
     import nose
     nose.run(argv=['', __file__])



More information about the Scipy-svn mailing list