@pytest.mark.parametrize('npartitions', [1, 4, 7, pytest.param(23, marks=pytest.mark.slow)])
def test_set_index_general(npartitions, shuffle_method):
    df = pd.DataFrame({'x': np.random.random(100), 'y': (np.random.random(100) // 0.2)}, index=np.random.random(100))
    ddf = dd.from_pandas(df, npartitions=npartitions)
    assert_eq(df.set_index('x'), ddf.set_index('x', shuffle=shuffle_method))
    assert_eq(df.set_index('y'), ddf.set_index('y', shuffle=shuffle_method))
    assert_eq(df.set_index(df.x), ddf.set_index(ddf.x, shuffle=shuffle_method))
    assert_eq(df.set_index((df.x + df.y)), ddf.set_index((ddf.x + ddf.y), shuffle=shuffle_method))
    assert_eq(df.set_index((df.x + 1)), ddf.set_index((ddf.x + 1), shuffle=shuffle_method))
    assert_eq(df.set_index(df.index), ddf.set_index(ddf.index, shuffle=shuffle_method))
@pytest.mark.parametrize('npartitions', [1, 4, 7, pytest.param(23, marks=pytest.mark.slow)])
def test_set_index_general(npartitions, shuffle_method):
    df = pd.DataFrame({'x': np.random.random(100), 'y': (np.random.random(100) // 0.2)}, index=np.random.random(100))
    ddf = dd.from_pandas(df, npartitions=npartitions)
    assert_eq(df.set_index('x'), ddf.set_index('x', shuffle=shuffle_method))
    assert_eq(df.set_index('y'), ddf.set_index('y', shuffle=shuffle_method))
    assert_eq(df.set_index(df.x), ddf.set_index(ddf.x, shuffle=shuffle_method))
    assert_eq(df.set_index((df.x + df.y)), ddf.set_index((ddf.x + ddf.y), shuffle=shuffle_method))
    assert_eq(df.set_index((df.x + 1)), ddf.set_index((ddf.x + 1), shuffle=shuffle_method))
    assert_eq(df.set_index(df.index), ddf.set_index(ddf.index, shuffle=shuffle_method))