MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_compress_flushblock

Method test_compress_flushblock

Lib/test/test_zstd.py:350–366  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

decompressFunction · 0.90
lenFunction · 0.85
assertRaisesRegexMethod · 0.80
assertEqualMethod · 0.45
compressMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected