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

Function test_index_errors

dask/dataframe/tests/test_dataframe.py:3568–3579  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3566
3567
3568def test_index_errors():
3569 df = _compat.makeTimeDataFrame()
3570 ddf = dd.from_pandas(df.reset_index(), npartitions=2)
3571 with pytest.raises(NotImplementedError, match="You tried to index with this index"):
3572 ddf.set_index([["A"]]) # should index with ["A"] instead of [["A"]]
3573 with pytest.raises(NotImplementedError, match="You tried to index with a frame"):
3574 ddf.set_index(ddf[["A"]]) # should index with ddf["A"] instead of ddf[["A"]]
3575 with pytest.raises(KeyError, match="has no column|None of"):
3576 ddf.set_index("foo") # a column that doesn't exist
3577 with pytest.raises(KeyError, match="has no column|None of"):
3578 # column name doesn't need to be a string, but anyhow a KeyError should be raised if not found
3579 ddf.set_index(0)
3580
3581
3582@pytest.mark.parametrize("null_value", [None, pd.NaT, pd.NA])

Callers

nothing calls this directly

Calls 2

reset_indexMethod · 0.80
set_indexMethod · 0.80

Tested by

no test coverage detected