MCPcopy
hub / github.com/dask/dask / test_to_csv_header_empty_dataframe

Function test_to_csv_header_empty_dataframe

dask/dataframe/io/tests/test_csv.py:1665–1676  ·  view source on GitHub ↗
(header, expected)

Source from the content-addressed store, hash-verified

1663
1664@pytest.mark.parametrize("header, expected", [(False, ""), (True, "x,y\n")])
1665def test_to_csv_header_empty_dataframe(header, expected):
1666 dfe = pd.DataFrame({"x": [], "y": []})
1667 ddfe = dd.from_pandas(dfe, npartitions=1)
1668
1669 with tmpdir() as dn:
1670 ddfe.to_csv(os.path.join(dn, "fooe*.csv"), index=False, header=header)
1671 assert not os.path.exists(os.path.join(dn, "fooe1.csv"))
1672 filename = os.path.join(dn, "fooe0.csv")
1673 with open(filename) as fp:
1674 line = fp.readline()
1675 assert line == expected
1676 os.remove(filename)
1677
1678
1679@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 4

tmpdirFunction · 0.90
to_csvMethod · 0.80
removeMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…