[Scipy-svn] r6748 - in trunk/scipy/signal: . tests

scipy-svn@scip... scipy-svn@scip...
Sat Sep 11 19:57:47 CDT 2010


Author: ptvirtan
Date: 2010-09-11 19:57:47 -0500 (Sat, 11 Sep 2010)
New Revision: 6748

Modified:
   trunk/scipy/signal/tests/test_signaltools.py
   trunk/scipy/signal/windows.py
Log:
3K: signal: fix types.* issues

Modified: trunk/scipy/signal/tests/test_signaltools.py
===================================================================
--- trunk/scipy/signal/tests/test_signaltools.py	2010-09-12 00:57:31 UTC (rev 6747)
+++ trunk/scipy/signal/tests/test_signaltools.py	2010-09-12 00:57:47 UTC (rev 6748)
@@ -569,11 +569,17 @@
         assert_array_almost_equal(y, y_r)
         self.failUnless(y.dtype == self.dt)
 
+def _get_testcorrelate_class(i, base):
+    class TestCorrelateX(base):
+        dt = i
+    TestCorrelateX.__name__ = "TestCorrelate%s" % i.__name__.title()
+    return TestCorrelateX
+
 for i in [np.ubyte, np.byte, np.ushort, np.short, np.uint, np.int,
         np.ulonglong, np.ulonglong, np.float32, np.float64, np.longdouble,
         Decimal]:
-    name = "TestCorrelate%s" % i.__name__.title()
-    globals()[name] = types.ClassType(name, (_TestCorrelateReal,), {"dt": i})
+    cls = _get_testcorrelate_class(i, _TestCorrelateReal)
+    globals()[cls.__name__] = cls
 
 class _TestCorrelateComplex(TestCase):
     dt = None
@@ -660,8 +666,8 @@
         self.failUnless(y.dtype == self.dt)
 
 for i in [np.csingle, np.cdouble, np.clongdouble]:
-    name = "TestCorrelate%s" % i.__name__.title()
-    globals()[name] = types.ClassType(name, (_TestCorrelateComplex,), {"dt": i})
+    cls = _get_testcorrelate_class(i, _TestCorrelateComplex)
+    globals()[cls.__name__] = cls
 
 class TestFiltFilt:
     def test_basic(self):

Modified: trunk/scipy/signal/windows.py
===================================================================
--- trunk/scipy/signal/windows.py	2010-09-12 00:57:31 UTC (rev 6747)
+++ trunk/scipy/signal/windows.py	2010-09-12 00:57:47 UTC (rev 6748)
@@ -423,11 +423,11 @@
         beta = float(window)
     except (TypeError, ValueError):
         args = ()
-        if isinstance(window, types.TupleType):
+        if isinstance(window, tuple):
             winstr = window[0]
             if len(window) > 1:
                 args = window[1:]
-        elif isinstance(window, types.StringType):
+        elif isinstance(window, str):
             if window in ['kaiser', 'ksr', 'gaussian', 'gauss', 'gss',
                         'general gaussian', 'general_gaussian',
                         'general gauss', 'general_gauss', 'ggs',



More information about the Scipy-svn mailing list