[Scipy-svn] r3008 - in trunk/Lib/interpolate: . tests
scipy-svn@scip...
scipy-svn@scip...
Tue May 15 15:56:40 CDT 2007
Author: oliphant
Date: 2007-05-15 15:56:36 -0500 (Tue, 15 May 2007)
New Revision: 3008
Modified:
trunk/Lib/interpolate/interpolate.py
trunk/Lib/interpolate/tests/test_interpolate.py
Log:
Fix typo in interpolate.py and add some 'completion-only' tests
Modified: trunk/Lib/interpolate/interpolate.py
===================================================================
--- trunk/Lib/interpolate/interpolate.py 2007-05-15 19:41:05 UTC (rev 3007)
+++ trunk/Lib/interpolate/interpolate.py 2007-05-15 20:56:36 UTC (rev 3008)
@@ -178,14 +178,14 @@
self.fill_value = fill_value
- if isinstance(kind, integer):
+ if isinstance(kind, int):
kind = {0:'zero',
1:'slinear',
2:'quadratic',
- 3:'cubic'}.get(kind,'bad')
+ 3:'cubic'}.get(kind,'none')
if kind not in ['zero', 'linear', 'slinear', 'quadratic', 'cubic']:
- raise NotImplementedError("%d unsupported: Use fitpack "\
+ raise NotImplementedError("%d is unsupported: Use fitpack "\
"routines for other types.")
x = array(x, copy=self.copy)
y = array(y, copy=self.copy)
Modified: trunk/Lib/interpolate/tests/test_interpolate.py
===================================================================
--- trunk/Lib/interpolate/tests/test_interpolate.py 2007-05-15 19:41:05 UTC (rev 3007)
+++ trunk/Lib/interpolate/tests/test_interpolate.py 2007-05-15 20:56:36 UTC (rev 3008)
@@ -39,9 +39,16 @@
are given to the constructor.
"""
- # Only kind='linear' is implemented.
- self.assertRaises(NotImplementedError, interp1d, self.x10, self.y10, kind='cubic')
+ # These should all work.
interp1d(self.x10, self.y10, kind='linear')
+ interp1d(self.x10, self.y10, kind='cubic')
+ interp1d(self.x10, self.y10, kind='slinear')
+ interp1d(self.x10, self.y10, kind='quadratic')
+ interp1d(self.x10, self.y10, kind='zero')
+ interp1d(self.x10, self.y10, kind=0)
+ interp1d(self.x10, self.y10, kind=1)
+ interp1d(self.x10, self.y10, kind=2)
+ interp1d(self.x10, self.y10, kind=3)
# x array must be 1D.
self.assertRaises(ValueError, interp1d, self.x25, self.y10)
More information about the Scipy-svn
mailing list