MCPcopy
hub / github.com/dask/dask / test_from_delayed

Function test_from_delayed

dask/dataframe/dask_expr/io/tests/test_delayed.py:23–41  ·  view source on GitHub ↗
(prefix)

Source from the content-addressed store, hash-verified

21
22@pytest.mark.parametrize("prefix", [None, "foo"])
23def test_from_delayed(prefix):
24 pdf = pd.DataFrame(
25 data=np.random.normal(size=(10, 4)), columns=["a", "b", "c", "d"]
26 )
27 parts = [pdf.iloc[:1], pdf.iloc[1:3], pdf.iloc[3:6], pdf.iloc[6:10]]
28 dfs = [delayed(parts.__getitem__)(i) for i in range(4)]
29
30 df = from_delayed(dfs, meta=pdf.head(0), divisions=None, prefix=prefix)
31 assert_eq(df, pdf)
32 # +1 due to an Alias for correct naming
33 assert len({k[0] for k in df.optimize().dask}) == 3
34 if prefix:
35 assert df._name.startswith(prefix)
36
37 divisions = tuple([p.index[0] for p in parts] + [parts[-1].index[-1]])
38 df = from_delayed(dfs, meta=pdf.head(0), divisions=divisions, prefix=prefix)
39 assert_eq(df, pdf)
40 if prefix:
41 assert df._name.startswith(prefix)
42
43
44def test_from_delayed_dask():

Callers

nothing calls this directly

Calls 6

delayedFunction · 0.90
from_delayedFunction · 0.90
assert_eqFunction · 0.90
normalMethod · 0.45
headMethod · 0.45
optimizeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…