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

Function test_compression

dask/bytes/tests/test_s3.py:386–410  ·  view source on GitHub ↗
(s3, fmt, blocksize, s3so)

Source from the content-addressed store, hash-verified

384 [(fmt, None) for fmt in compr] + [(fmt, 10) for fmt in compr],
385)
386def test_compression(s3, fmt, blocksize, s3so):
387 if fmt not in compress:
388 pytest.skip("compression function not provided")
389 s3._cache.clear()
390 with s3_context("compress", valmap(compress[fmt], files)):
391 if fmt and blocksize:
392 with pytest.raises(ValueError):
393 read_bytes(
394 "s3://compress/test/accounts.*",
395 compression=fmt,
396 blocksize=blocksize,
397 **s3so,
398 )
399 return
400 sample, values = read_bytes(
401 "s3://compress/test/accounts.*",
402 compression=fmt,
403 blocksize=blocksize,
404 **s3so,
405 )
406 assert sample.startswith(files[sorted(files)[0]][:10])
407 assert sample.endswith(b"\n")
408
409 results = compute(*concat(values))
410 assert b"".join(results) == b"".join([files[k] for k in sorted(files)])
411
412
413@pytest.mark.parametrize("mode", ["rt", "rb"])

Callers

nothing calls this directly

Calls 7

read_bytesFunction · 0.90
computeFunction · 0.90
s3_contextFunction · 0.85
skipMethod · 0.80
concatFunction · 0.50
clearMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…