summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_function_base.py
diff options
context:
space:
mode:
authorMatteo Raso <matteo_luigi_raso@protonmail.com>2023-01-27 02:03:00 -0500
committerMatteo Raso <matteo_luigi_raso@protonmail.com>2023-01-27 02:03:00 -0500
commit84596aeec1682de93d82c60b53726838b29ad311 (patch)
tree0bd675f119267cecfea765977081b5f3a3da97a4 /numpy/lib/tests/test_function_base.py
parentd961af2f8006657e5309f8c91d50bad8a2b9b0c5 (diff)
downloadnumpy-84596aeec1682de93d82c60b53726838b29ad311.tar.gz
Added test for vectorize decorator project
This test makes sure a function's docstring is properly preserved after calling the vectorize decorator.
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r--numpy/lib/tests/test_function_base.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py
index 169484a09..6499b78b7 100644
--- a/numpy/lib/tests/test_function_base.py
+++ b/numpy/lib/tests/test_function_base.py
@@ -1799,6 +1799,14 @@ class TestVectorize:
r = addsubtract([0, 3, 6, 9], [1, 3, 5, 7])
assert_array_equal(r, [1, 6, 1, 2])
+ def test_docstring(self):
+ @vectorize
+ def f(x):
+ """Docstring"""
+ return x
+
+ assert f.__doc__ == "Docstring"
+
def test_signature_otypes_decorator(self):
@vectorize(signature='(n)->(n)', otypes=['float64'])
def f(x):