diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-02-23 14:55:01 +0000 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-03-07 17:33:20 +0000 |
commit | 11c5a9f3fed6ccd2a8f77b22cc1abb405b9d24ab (patch) | |
tree | 42c8071676ddf156444de866054c1ad5c6cd9828 /numpy/lib/tests/test_arraysetops.py | |
parent | f91eb364283bf6066f3a18e4b9738bc3452d155b (diff) | |
download | numpy-11c5a9f3fed6ccd2a8f77b22cc1abb405b9d24ab.tar.gz |
BUG: Make MaskedArray.argsort and MaskedArray.sort consistent
Previously, these had different rules for unmasking values, and even different
arguments to decide how to do so.
Fixes #8664
Diffstat (limited to 'numpy/lib/tests/test_arraysetops.py')
-rw-r--r-- | numpy/lib/tests/test_arraysetops.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_arraysetops.py b/numpy/lib/tests/test_arraysetops.py index 8b142c264..eb4cca0ce 100644 --- a/numpy/lib/tests/test_arraysetops.py +++ b/numpy/lib/tests/test_arraysetops.py @@ -352,6 +352,18 @@ class TestUnique(TestCase): result = np.array([[-0.0, 0.0]]) assert_array_equal(unique(data, axis=0), result, msg) + def test_unique_masked(self): + # issue 8664 + x = np.array([64, 0, 1, 2, 3, 63, 63, 0, 0, 0, 1, 2, 0, 63, 0], dtype='uint8') + y = np.ma.masked_equal(x, 0) + + v = np.unique(y) + v2, i, c = np.unique(y, return_index=True, return_counts=True) + + msg = 'Unique returned different results when asked for index' + assert_array_equal(v.data, v2.data, msg) + assert_array_equal(v.mask, v2.mask, msg) + def _run_axis_tests(self, dtype): data = np.array([[0, 1, 0, 0], [1, 0, 0, 0], |