MCPcopy
hub / github.com/dask/dask / test_from_delayed_misordered_meta

Function test_from_delayed_misordered_meta

dask/dataframe/io/tests/test_io.py:702–723  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

700
701
702def test_from_delayed_misordered_meta():
703 df = pd.DataFrame(
704 columns=["(1)", "(2)", "date", "ent", "val"],
705 data=[range(i * 5, i * 5 + 5) for i in range(3)],
706 index=range(3),
707 )
708
709 # meta with different order for columns
710 misordered_meta = pd.DataFrame(
711 columns=["date", "ent", "val", "(1)", "(2)"], data=[range(5)]
712 )
713
714 ddf = dd.from_delayed([delayed(lambda: df)()], meta=misordered_meta)
715
716 with pytest.raises(ValueError) as info:
717 # produces dataframe which does not match meta
718 ddf.reset_index().compute(scheduler="sync")
719 msg = (
720 "The columns in the computed data do not match the columns in the"
721 " provided metadata"
722 )
723 assert msg in str(info.value)
724
725
726def test_to_delayed():

Callers

nothing calls this directly

Calls 4

delayedFunction · 0.90
from_delayedMethod · 0.80
reset_indexMethod · 0.80
computeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…