From a9465db4c70f9cd9c3fb9010229aadc7ec5fdc9c Mon Sep 17 00:00:00 2001 From: Allan Haldane Date: Wed, 11 May 2016 00:10:58 -0400 Subject: BUG: distance arg of np.gradient must be scalar, fix docstring Fixups to docstring, and disallow non-scalars as the distance args to np.gradient. Fixes #7548, fixes #6847 --- numpy/lib/tests/test_function_base.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'numpy/lib/tests/test_function_base.py') diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index 34dfd5ecc..044279294 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -666,6 +666,9 @@ class TestGradient(TestCase): assert_raises(SyntaxError, gradient, x, np.array([1., 1.]), np.array([1., 1.]), np.array([1., 1.])) + # disallow arrays as distances, see gh-6847 + assert_raises(ValueError, gradient, np.arange(5), np.ones(5)) + def test_masked(self): # Make sure that gradient supports subclasses like masked arrays x = np.ma.array([[1, 1], [3, 4]], -- cgit v1.2.1