Permalink
Browse files

BUG: interpolate/interpnd: fix format code typo in an error message

  • Loading branch information...
1 parent 3dcb8a4 commit 1786c5ce2e16056124094a1a95d15763a620f2a3 @pv pv committed Mar 11, 2011
Showing with 7 additions and 2 deletions.
  1. +1 −1 scipy/interpolate/interpnd.pyx
  2. +6 −1 scipy/interpolate/tests/test_interpnd.py
View
2 scipy/interpolate/interpnd.pyx
@@ -97,7 +97,7 @@ class NDInterpolatorBase(object):
raise ValueError("input data must be at least 2-D")
if ndim is not None and points.shape[1] != ndim:
raise ValueError("this mode of interpolation available only for "
- "%-D data" % ndim)
+ "%d-D data" % ndim)
def _check_call_shape(self, xi):
xi = np.asanyarray(xi)
View
7 scipy/interpolate/tests/test_interpnd.py
@@ -1,6 +1,6 @@
import numpy as np
from numpy.testing import assert_equal, assert_allclose, assert_almost_equal, \
- run_module_suite
+ run_module_suite, assert_raises
import scipy.interpolate.interpnd as interpnd
import scipy.spatial.qhull as qhull
@@ -182,5 +182,10 @@ def test_dense(self):
self._check_accuracy(func, x=grid, tol=1e-9, atol=5e-3, rtol=1e-2,
err_msg="Function %d" % j)
+ def test_wrong_ndim(self):
+ x = np.random.randn(30, 3)
+ y = np.random.randn(30)
+ assert_raises(ValueError, interpnd.CloughTocher2DInterpolator, x, y)
+
if __name__ == "__main__":
run_module_suite()

0 comments on commit 1786c5c

Please sign in to comment.