MCPcopy Create free account
hub / github.com/dask/dask / test_sort_values_

Function test_sort_values_

dask/dataframe/dask_expr/tests/test_shuffle.py:189–200  ·  view source on GitHub ↗
(nelem, by, ascending)

Source from the content-addressed store, hash-verified

187@pytest.mark.parametrize("by", ["a", "b", ["a", "b"]])
188@pytest.mark.parametrize("nelem", [10, 500])
189def test_sort_values_(nelem, by, ascending):
190 np.random.seed(0)
191 df = pd.DataFrame()
192 df["a"] = np.ascontiguousarray(np.arange(nelem)[::-1])
193 df["b"] = np.arange(100, nelem + 100)
194 ddf = from_pandas(df, npartitions=10)
195
196 # run on single-threaded scheduler for debugging purposes
197 with dask.config.set(scheduler="single-threaded"):
198 got = ddf.sort_values(by=by, ascending=ascending)
199 expect = df.sort_values(by=by, ascending=ascending)
200 assert_eq(got, expect, check_index=False, sort_results=False)
201
202
203@pytest.mark.parametrize("ascending", [True, False, [False, True], [True, False]])

Callers

nothing calls this directly

Calls 6

sort_valuesMethod · 0.95
from_pandasFunction · 0.90
assert_eqFunction · 0.90
setMethod · 0.80
seedMethod · 0.45
arangeMethod · 0.45

Tested by

no test coverage detected