MCPcopy Index your code
hub / github.com/python/cpython / test_compressor

Method test_compressor

Lib/test/test_free_threading/test_lzma.py:17–33  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

15@threading_helper.requires_working_threading()
16class TestLZMA(unittest.TestCase):
17 def test_compressor(self):
18 lzc = LZMACompressor()
19
20 # First compress() outputs LZMA header
21 header = lzc.compress(INPUT)
22 self.assertGreater(len(header), 0)
23
24 def worker():
25 # it should return empty bytes as it buffers data internally
26 data = lzc.compress(INPUT)
27 self.assertEqual(data, b"")
28
29 run_concurrently(worker_func=worker, nthreads=NTHREADS - 1)
30 full_compressed = header + lzc.flush()
31 decompressed = lzma.decompress(full_compressed)
32 # The decompressed data should be INPUT repeated NTHREADS times
33 self.assertEqual(decompressed, INPUT * NTHREADS)
34
35 def test_decompressor(self):
36 chunk_size = 128

Callers

nothing calls this directly

Calls 7

compressMethod · 0.95
flushMethod · 0.95
run_concurrentlyFunction · 0.90
LZMACompressorClass · 0.85
assertGreaterMethod · 0.80
decompressMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected