[Scipy-svn] r7068 - branches/0.9.x/scipy/signal/tests
scipy-svn at scipy.org
scipy-svn at scipy.org
Thu Jan 20 06:29:55 EST 2011
Author: rgommers
Date: 2011-01-20 05:29:54 -0600 (Thu, 20 Jan 2011)
New Revision: 7068
Modified:
branches/0.9.x/scipy/signal/tests/test_signaltools.py
Log:
BUG/TST: The test of complex case of the correlate() function did not properly take into account the platform dependence of the longdouble type.
(backport of r7067)
Modified: branches/0.9.x/scipy/signal/tests/test_signaltools.py
===================================================================
--- branches/0.9.x/scipy/signal/tests/test_signaltools.py 2011-01-18 20:30:12 UTC (rev 7067)
+++ branches/0.9.x/scipy/signal/tests/test_signaltools.py 2011-01-20 11:29:54 UTC (rev 7068)
@@ -576,16 +576,16 @@
self.assertTrue(y.dtype == self.dt)
-def _get_testcorrelate_class(i, base):
+def _get_testcorrelate_class(datatype, base):
class TestCorrelateX(base):
- dt = i
- TestCorrelateX.__name__ = "TestCorrelate%s" % i.__name__.title()
+ dt = datatype
+ TestCorrelateX.__name__ = "TestCorrelate%s" % datatype.__name__.title()
return TestCorrelateX
-for i in [np.ubyte, np.byte, np.ushort, np.short, np.uint, np.int,
+for datatype in [np.ubyte, np.byte, np.ushort, np.short, np.uint, np.int,
np.ulonglong, np.ulonglong, np.float32, np.float64, np.longdouble,
Decimal]:
- cls = _get_testcorrelate_class(i, _TestCorrelateReal)
+ cls = _get_testcorrelate_class(datatype, _TestCorrelateReal)
globals()[cls.__name__] = cls
@@ -683,13 +683,11 @@
self.assertTrue(y.dtype == self.dt)
-# Create three classes, one for each complex data type: TestCorrelateComplex64,
-# TestCorrelateComplex128 and TestCorrelateComplex256.
-# The second number in the pairs is used in the 'decimal' keyword argument of
-# the array comparisons in the tests.
-for i, decimal in [(np.csingle, 5), (np.cdouble, 10), (np.clongdouble, 15)]:
- cls = _get_testcorrelate_class(i, _TestCorrelateComplex)
- cls.decimal = decimal
+# Create three classes, one for each complex data type. The actual class
+# name will be TestCorrelateComplex###, where ### is the number of bits.
+for datatype in [np.csingle, np.cdouble, np.clongdouble]:
+ cls = _get_testcorrelate_class(datatype, _TestCorrelateComplex)
+ cls.decimal = int(2 * np.finfo(datatype).precision / 3)
globals()[cls.__name__] = cls
More information about the Scipy-svn
mailing list