diff options
author | Lakshay Garg <lakshayg@outlook.in> | 2018-03-25 01:17:13 +0530 |
---|---|---|
committer | Lakshay Garg <lakshayg@outlook.in> | 2018-03-25 01:17:13 +0530 |
commit | 14955ccf2a6d838705abb21b237179ecfdbae19f (patch) | |
tree | 3b7d1a29a08398855612580ba7622a060677426a /numpy/ma | |
parent | 6d1e7e939c598391399562ee93e3ad2a06dc8046 (diff) | |
download | numpy-14955ccf2a6d838705abb21b237179ecfdbae19f.tar.gz |
add test for stable sort
Diffstat (limited to 'numpy/ma')
-rw-r--r-- | numpy/ma/tests/test_core.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py index 4c6bb2b42..ff1e087b5 100644 --- a/numpy/ma/tests/test_core.py +++ b/numpy/ma/tests/test_core.py @@ -3200,6 +3200,12 @@ class TestMaskedArrayMethods(object): assert_equal(sortedx._data, [1, 2, -2, -1, 0]) assert_equal(sortedx._mask, [1, 1, 0, 0, 0]) + def test_stable_sort(self): + x = array([1, 2, 3, 1, 2, 3], dtype=np.uint8) + expected = array([0, 3, 1, 4, 2, 5]) + computed = argsort(x, kind='stable') + assert_equal(computed, expected) + def test_argsort_matches_sort(self): x = array([1, 4, 2, 3], mask=[0, 1, 0, 0], dtype=np.uint8) |