Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

3K: signal: fix types.* issues

  • Loading branch information...
commit 4d39a08855cfb4e5deecddfc830b21905eed649f 1 parent aac0edf
@pv pv authored
Showing with 12 additions and 6 deletions.
  1. +10 −4 scipy/signal/tests/test_signaltools.py
  2. +2 −2 scipy/signal/windows.py
View
14 scipy/signal/tests/test_signaltools.py
@@ -569,11 +569,17 @@ def test_rank3_all_old(self):
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 @@ def test_rank3_old(self):
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):
View
4 scipy/signal/windows.py
@@ -423,11 +423,11 @@ def get_window(window, Nx, fftbins=True):
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',
Please sign in to comment.
Something went wrong with that request. Please try again.