(by, nparts)
| 1172 | @pytest.mark.parametrize("by", [["a", "b"], ["b", "a"]]) |
| 1173 | @pytest.mark.parametrize("nparts", [1, 10]) |
| 1174 | def test_sort_values_custom_function(by, nparts): |
| 1175 | df = pd.DataFrame({"a": [1, 2, 3] * 20, "b": [4, 5, 6, 7] * 15}) |
| 1176 | ddf = dd.from_pandas(df, npartitions=nparts) |
| 1177 | |
| 1178 | def f(partition, by_columns, ascending, na_position, **kwargs): |
| 1179 | return partition.sort_values( |
| 1180 | by_columns, ascending=ascending, na_position=na_position |
| 1181 | ) |
| 1182 | |
| 1183 | # run on single-threaded scheduler for debugging purposes |
| 1184 | with dask.config.set(scheduler="single-threaded"): |
| 1185 | got = ddf.sort_values( |
| 1186 | by=by[0], sort_function=f, sort_function_kwargs={"by_columns": by} |
| 1187 | ) |
| 1188 | expect = df.sort_values(by=by) |
| 1189 | dd.assert_eq(got, expect, check_index=False) |
| 1190 | |
| 1191 | |
| 1192 | def test_sort_values_bool_ascending(): |
nothing calls this directly
no test coverage detected