diff options
author | Matteo Raso <matteo_luigi_raso@protonmail.com> | 2023-02-08 20:39:55 -0500 |
---|---|---|
committer | Matteo Raso <matteo_luigi_raso@protonmail.com> | 2023-02-08 20:39:55 -0500 |
commit | 7a2ded1522305cfbab4e34a18198f3cbcae7755c (patch) | |
tree | a35eb8a086354d49e4249ad959622373bc940e87 /numpy/lib/tests | |
parent | 84596aeec1682de93d82c60b53726838b29ad311 (diff) | |
download | numpy-7a2ded1522305cfbab4e34a18198f3cbcae7755c.tar.gz |
Added a test for positional args (PR-23061)
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index 6499b78b7..b56d776cb 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -1817,6 +1817,17 @@ 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_positional_regression_9477(self): # This supplies the first keyword argument as a positional, # to ensure that they are still properly forwarded after the |