(self)
| 3492 | assert_equal(x._mask.shape, (4,)) |
| 3493 | |
| 3494 | def test_sort(self): |
| 3495 | # Test sort |
| 3496 | x = array([1, 4, 2, 3], mask=[0, 1, 0, 0], dtype=np.uint8) |
| 3497 | |
| 3498 | sortedx = sort(x) |
| 3499 | assert_equal(sortedx._data, [1, 2, 3, 4]) |
| 3500 | assert_equal(sortedx._mask, [0, 0, 0, 1]) |
| 3501 | |
| 3502 | sortedx = sort(x, endwith=False) |
| 3503 | assert_equal(sortedx._data, [4, 1, 2, 3]) |
| 3504 | assert_equal(sortedx._mask, [1, 0, 0, 0]) |
| 3505 | |
| 3506 | x.sort() |
| 3507 | assert_equal(x._data, [1, 2, 3, 4]) |
| 3508 | assert_equal(x._mask, [0, 0, 0, 1]) |
| 3509 | |
| 3510 | x = array([1, 4, 2, 3], mask=[0, 1, 0, 0], dtype=np.uint8) |
| 3511 | x.sort(endwith=False) |
| 3512 | assert_equal(x._data, [4, 1, 2, 3]) |
| 3513 | assert_equal(x._mask, [1, 0, 0, 0]) |
| 3514 | |
| 3515 | x = [1, 4, 2, 3] |
| 3516 | sortedx = sort(x) |
| 3517 | assert_(not isinstance(sorted, MaskedArray)) |
| 3518 | |
| 3519 | x = array([0, 1, -1, -2, 2], mask=nomask, dtype=np.int8) |
| 3520 | sortedx = sort(x, endwith=False) |
| 3521 | assert_equal(sortedx._data, [-2, -1, 0, 1, 2]) |
| 3522 | x = array([0, 1, -1, -2, 2], mask=[0, 1, 0, 0, 1], dtype=np.int8) |
| 3523 | sortedx = sort(x, endwith=False) |
| 3524 | assert_equal(sortedx._data, [1, 2, -2, -1, 0]) |
| 3525 | assert_equal(sortedx._mask, [1, 1, 0, 0, 0]) |
| 3526 | |
| 3527 | x = array([0, -1], dtype=np.int8) |
| 3528 | sortedx = sort(x, kind="stable") |
| 3529 | assert_equal(sortedx, array([-1, 0], dtype=np.int8)) |
| 3530 | |
| 3531 | def test_stable_sort(self): |
| 3532 | x = array([1, 2, 3, 1, 2, 3], dtype=np.uint8) |
nothing calls this directly
no test coverage detected