diff options
author | Ross Barnowski <rossbar@berkeley.edu> | 2022-10-19 19:35:25 -0700 |
---|---|---|
committer | Ross Barnowski <rossbar@berkeley.edu> | 2022-10-19 19:35:25 -0700 |
commit | 8ca9221ec58e65dbf2ac9d669de216c0366088c1 (patch) | |
tree | 7a2a76ca84613b292613d5a9ad1a1429264d6011 /numpy/lib | |
parent | ce057d29087f93fe3eafd96fcd7e9a2d0c46ddd4 (diff) | |
download | numpy-8ca9221ec58e65dbf2ac9d669de216c0366088c1.tar.gz |
DEP: Add deprecation warning and check warning in test.
Diffstat (limited to 'numpy/lib')
-rw-r--r-- | numpy/lib/function_base.py | 5 | ||||
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 11 |
2 files changed, 11 insertions, 5 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 67ea54635..414752613 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -3678,6 +3678,11 @@ def msort(a): [3, 4]]) """ + warnings.warn( + "msort is deprecated, use np.sort(a, axis=0) instead", + DeprecationWarning, + stacklevel=3, + ) b = array(a, subok=True, copy=True) b.sort(0) return b diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index 277843222..e407fc78c 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -2427,11 +2427,12 @@ class TestMsort: A = np.array([[0.44567325, 0.79115165, 0.54900530], [0.36844147, 0.37325583, 0.96098397], [0.64864341, 0.52929049, 0.39172155]]) - assert_almost_equal( - msort(A), - np.array([[0.36844147, 0.37325583, 0.39172155], - [0.44567325, 0.52929049, 0.54900530], - [0.64864341, 0.79115165, 0.96098397]])) + with pytest.warns(DeprecationWarning, match="msort is deprecated"): + assert_almost_equal( + msort(A), + np.array([[0.36844147, 0.37325583, 0.39172155], + [0.44567325, 0.52929049, 0.54900530], + [0.64864341, 0.79115165, 0.96098397]])) class TestMeshgrid: |