(self, data_for_sorting, ascending, sort_by_key)
| 212 | |
| 213 | @pytest.mark.parametrize("ascending", [True, False]) |
| 214 | def test_sort_values(self, data_for_sorting, ascending, sort_by_key): |
| 215 | ser = pd.Series(data_for_sorting) |
| 216 | result = ser.sort_values(ascending=ascending, key=sort_by_key) |
| 217 | expected = ser.iloc[[2, 0, 1]] |
| 218 | if not ascending: |
| 219 | # GH 35922. Expect stable sort |
| 220 | if ser.nunique() == 2: |
| 221 | expected = ser.iloc[[0, 1, 2]] |
| 222 | else: |
| 223 | expected = ser.iloc[[1, 0, 2]] |
| 224 | |
| 225 | tm.assert_series_equal(result, expected) |
| 226 | |
| 227 | @pytest.mark.parametrize("ascending", [True, False]) |
| 228 | def test_sort_values_missing( |
nothing calls this directly
no test coverage detected