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

Function test_compression

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

Source from the content-addressed store, hash-verified

376@pytest.mark.parametrize("blocksize", [None, 10])
377@pytest.mark.parametrize("fmt", compr)
378def test_compression(s3, fmt, blocksize):
379 if fmt not in compress:
380 pytest.skip("compression function not provided")
381 s3._cache.clear()
382 with s3_context("compress", valmap(compress[fmt], files)):
383 if fmt and blocksize:
384 with pytest.raises(ValueError):
385 read_bytes(
386 "s3://compress/test/accounts.*",
387 compression=fmt,
388 blocksize=blocksize,
389 **s3so,
390 )
391 return
392 sample, values = read_bytes(
393 "s3://compress/test/accounts.*",
394 compression=fmt,
395 blocksize=blocksize,
396 **s3so,
397 )
398 assert sample.startswith(files[sorted(files)[0]][:10])
399 assert sample.endswith(b"\n")
400
401 results = compute(*concat(values))
402 assert b"".join(results) == b"".join([files[k] for k in sorted(files)])
403
404
405@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