MCPcopy
hub / github.com/dask/dask / test_compression

Function test_compression

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

Source from the content-addressed store, hash-verified

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…