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

Function test_read_csv_compression

dask/dataframe/io/tests/test_csv.py:770–790  ·  view source on GitHub ↗
(fmt, blocksize)

Source from the content-addressed store, hash-verified

768@pytest.mark.parametrize("blocksize", [None, 10])
769@pytest.mark.parametrize("fmt", compression_fmts)
770def test_read_csv_compression(fmt, blocksize):
771 if fmt and fmt not in compress:
772 pytest.skip("compress function not provided for %s" % fmt)
773
774 expected = read_files()
775 suffix = {"gzip": ".gz", "bz2": ".bz2", "zip": ".zip", "xz": ".xz"}.get(fmt, "")
776 files2 = valmap(compress[fmt], csv_files) if fmt else csv_files
777 renamed_files = {k + suffix: v for k, v in files2.items()}
778 with filetexts(renamed_files, mode="b"):
779 # This test is using `compression="infer"` (the default) for
780 # read_csv. The paths must have the appropriate extension.
781 if fmt and blocksize:
782 with pytest.warns(UserWarning):
783 df = dd.read_csv("2014-01-*.csv" + suffix, blocksize=blocksize)
784 else:
785 df = dd.read_csv("2014-01-*.csv" + suffix, blocksize=blocksize)
786 assert_eq(
787 df.compute(scheduler="sync").reset_index(drop=True),
788 expected.reset_index(drop=True),
789 check_dtype=False,
790 )
791
792
793@pytest.mark.skip

Callers

nothing calls this directly

Calls 9

filetextsFunction · 0.90
assert_eqFunction · 0.90
read_filesFunction · 0.85
skipMethod · 0.80
read_csvMethod · 0.80
reset_indexMethod · 0.80
getMethod · 0.45
itemsMethod · 0.45
computeMethod · 0.45

Tested by

no test coverage detected