summaryrefslogtreecommitdiff
path: root/numpy/lib/tests
diff options
context:
space:
mode:
authorSebastian Berg <sebastianb@nvidia.com>2023-01-26 12:16:23 +0100
committerSebastian Berg <sebastianb@nvidia.com>2023-02-10 14:49:16 +0100
commitc03e84044a05f0b2358a1cbfc4158e83cba4b835 (patch)
treed2d6acb05816db3a815f50967c0cb22f3d896c35 /numpy/lib/tests
parent624b18090ae567f3cfd528a8ae156b2ae7db6d82 (diff)
downloadnumpy-c03e84044a05f0b2358a1cbfc4158e83cba4b835.tar.gz
API: Modify `gradient` to return a tuple rather than a list
This change is staged for NumPy 2.0, I assume we could get away with it otherwise, but it is a nice example and probably not pressing.
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r--numpy/lib/tests/test_function_base.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py
index ecba35f2d..fb98a94cd 100644
--- a/numpy/lib/tests/test_function_base.py
+++ b/numpy/lib/tests/test_function_base.py
@@ -1217,6 +1217,13 @@ class TestGradient:
dfdx = gradient(f, x)
assert_array_equal(dfdx, [0.5, 0.5])
+ def test_return_type(self):
+ res = np.gradient(([1, 2], [2, 3]))
+ if np._numpy2_behavior:
+ assert type(res) is tuple
+ else:
+ assert type(res) is list
+
class TestAngle: