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

Function test_compression

dask/bytes/tests/test_local.py:194–218  ·  view source on GitHub ↗
(fmt, blocksize)

Source from the content-addressed store, hash-verified

192@pytest.mark.parametrize("blocksize", [None, 10])
193@pytest.mark.parametrize("fmt", compr)
194def test_compression(fmt, blocksize):
195 if fmt not in compress:
196 pytest.skip("compression function not provided")
197 files2 = valmap(compress[fmt], files)
198 with filetexts(files2, mode="b"):
199 if fmt and blocksize:
200 with pytest.raises(ValueError):
201 read_bytes(
202 ".test.accounts.*.json",
203 blocksize=blocksize,
204 delimiter=b"\n",
205 compression=fmt,
206 )
207 return
208 sample, values = read_bytes(
209 ".test.accounts.*.json",
210 blocksize=blocksize,
211 delimiter=b"\n",
212 compression=fmt,
213 )
214 assert sample[:5] == files[sorted(files)[0]][:5]
215 assert sample.endswith(b"\n")
216
217 results = compute(*concat(values))
218 assert b"".join(results) == b"".join([files[k] for k in sorted(files)])
219
220
221def test_open_files():

Callers

nothing calls this directly

Calls 6

filetextsFunction · 0.90
read_bytesFunction · 0.90
computeFunction · 0.90
skipMethod · 0.80
concatFunction · 0.50
joinMethod · 0.45

Tested by

no test coverage detected