def test_set_index_detects_sorted_data(shuffle_method):
    df = pd.DataFrame({'x': range(100), 'y': range(100)})
    ddf = dd.from_pandas(df, npartitions=10, name='x', sort=False)
    ddf2 = ddf.set_index('x', shuffle=shuffle_method)
    assert (len(ddf2.dask) < (ddf.npartitions * 4))
def test_set_index_detects_sorted_data(shuffle_method):
    df = pd.DataFrame({'x': range(100), 'y': range(100)})
    ddf = dd.from_pandas(df, npartitions=10, name='x', sort=False)
    ddf2 = ddf.set_index('x', shuffle=shuffle_method)
    assert (len(ddf2.dask) < (ddf.npartitions * 4))