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

Function test_compression

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

Source from the content-addressed store, hash-verified

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