From 2bfec2c0dd92958694e6d736530ae6333d7d62d7 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Thu, 13 Jul 2017 12:40:32 +0100 Subject: BUG: Only allow 1d distance arrays 2d arrays would work, but in unpredictable and undocumented ways. This at least makes gh-9401 give a better error message. --- numpy/lib/tests/test_function_base.py | 4 ++++ 1 file changed, 4 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 ee2cc166a..d7d00758e 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -756,6 +756,10 @@ class TestGradient(TestCase): # 2D but axis specified gradient(f_2d, dx, axis=1) + # 2d coordinate arguments are not yet allowed + assert_raises_regex(ValueError, '.*scalars or 1d', + gradient, f_2d, np.stack([dx]*2, axis=-1), 1) + def test_badargs(self): f_2d = np.arange(25).reshape(5, 5) x = np.cumsum(np.ones(5)) -- cgit v1.2.1