summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_function_base.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2017-07-13 12:40:32 +0100
committerEric Wieser <wieser.eric@gmail.com>2017-07-13 13:02:51 +0100
commit2bfec2c0dd92958694e6d736530ae6333d7d62d7 (patch)
tree0af7b27c6432619c8752bd33fe1754d2ed140612 /numpy/lib/tests/test_function_base.py
parentd86e3fee3c9906ce0fad36520de86d9ac306cee8 (diff)
downloadnumpy-2bfec2c0dd92958694e6d736530ae6333d7d62d7.tar.gz
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.
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r--numpy/lib/tests/test_function_base.py4
1 files changed, 4 insertions, 0 deletions
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))