(self)
| 348 | f.write(b) |
| 349 | |
| 350 | def test_compress_flushblock(self): |
| 351 | point = len(THIS_FILE_BYTES) // 2 |
| 352 | |
| 353 | c = ZstdCompressor() |
| 354 | self.assertEqual(c.last_mode, c.FLUSH_FRAME) |
| 355 | dat1 = c.compress(THIS_FILE_BYTES[:point]) |
| 356 | self.assertEqual(c.last_mode, c.CONTINUE) |
| 357 | dat1 += c.compress(THIS_FILE_BYTES[point:], c.FLUSH_BLOCK) |
| 358 | self.assertEqual(c.last_mode, c.FLUSH_BLOCK) |
| 359 | dat2 = c.flush() |
| 360 | pattern = "Compressed data ended before the end-of-stream marker" |
| 361 | with self.assertRaisesRegex(ZstdError, pattern): |
| 362 | decompress(dat1) |
| 363 | |
| 364 | dat3 = decompress(dat1 + dat2) |
| 365 | |
| 366 | self.assertEqual(dat3, THIS_FILE_BYTES) |
| 367 | |
| 368 | def test_compress_flushframe(self): |
| 369 | # test compress & decompress |
nothing calls this directly
no test coverage detected