(self)
| 15 | @threading_helper.requires_working_threading() |
| 16 | class 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 |
nothing calls this directly
no test coverage detected