diff options
author | Matteo Raso <matteo_luigi_raso@protonmail.com> | 2023-02-09 22:59:46 -0500 |
---|---|---|
committer | Matteo Raso <matteo_luigi_raso@protonmail.com> | 2023-02-09 22:59:46 -0500 |
commit | 4b82e29a18cd2c17b258bab0e2d937ab2157377b (patch) | |
tree | efd7b106b03ef53fb0ecaec9f76e6b998a8a6f35 /numpy/lib/tests | |
parent | 7a2ded1522305cfbab4e34a18198f3cbcae7755c (diff) | |
download | numpy-4b82e29a18cd2c17b258bab0e2d937ab2157377b.tar.gz |
@vectorize now requires arguments to specify keywords
This reverses commit 7a2ded1522305
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index b56d776cb..416a9431b 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -1817,16 +1817,15 @@ class TestVectorize: assert_array_equal(r, [1, 2, 3]) assert f.__name__ == 'f' - def test_decorator_positional_args(self): - A = np.vectorize(abs, ['float64'], "return float absolute value") - y1 = A([1, -1, 0, 0.3, 5]) - - @vectorize(['float64'], "return float absolute value") - def myabs(a): - return abs(a) - - y2 = myabs([1, -1, 0, 0.3, 5]) - assert_array_equal(y1, y2) + def test_bad_input(self): + with assert_raises(TypeError): + A = np.vectorize(pyfunc = 3) + + def test_no_keywords(self): + with assert_raises(TypeError): + @np.vectorize("string") + def foo(): + return "bar" def test_positional_regression_9477(self): # This supplies the first keyword argument as a positional, |