(self)
| 3803 | assert_equal(am, an) |
| 3804 | |
| 3805 | def test_sort_flexible(self): |
| 3806 | # Test sort on structured dtype. |
| 3807 | a = array( |
| 3808 | data=[(3, 3), (3, 2), (2, 2), (2, 1), (1, 0), (1, 1), (1, 2)], |
| 3809 | mask=[(0, 0), (0, 1), (0, 0), (0, 0), (1, 0), (0, 0), (0, 0)], |
| 3810 | dtype=[('A', int), ('B', int)]) |
| 3811 | mask_last = array( |
| 3812 | data=[(1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (3, 2), (1, 0)], |
| 3813 | mask=[(0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 1), (1, 0)], |
| 3814 | dtype=[('A', int), ('B', int)]) |
| 3815 | mask_first = array( |
| 3816 | data=[(1, 0), (1, 1), (1, 2), (2, 1), (2, 2), (3, 2), (3, 3)], |
| 3817 | mask=[(1, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 1), (0, 0)], |
| 3818 | dtype=[('A', int), ('B', int)]) |
| 3819 | |
| 3820 | test = sort(a) |
| 3821 | assert_equal(test, mask_last) |
| 3822 | assert_equal(test.mask, mask_last.mask) |
| 3823 | |
| 3824 | test = sort(a, endwith=False) |
| 3825 | assert_equal(test, mask_first) |
| 3826 | assert_equal(test.mask, mask_first.mask) |
| 3827 | |
| 3828 | # Test sort on dtype with subarray (gh-8069) |
| 3829 | # Just check that the sort does not error, structured array subarrays |
| 3830 | # are treated as byte strings and that leads to differing behavior |
| 3831 | # depending on endianness and `endwith`. |
| 3832 | dt = np.dtype([('v', int, 2)]) |
| 3833 | a = a.view(dt) |
| 3834 | test = sort(a) |
| 3835 | test = sort(a, endwith=False) |
| 3836 | |
| 3837 | def test_argsort(self): |
| 3838 | # Test argsort |
nothing calls this directly
no test coverage detected