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