Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_empty(self):
cctx = zstd.ZstdCompressor()
frame = cctx.compress(b"")
self.assertEqual(zstd.frame_content_size(frame), 0)
def test_bad_frame(self):
with self.assertRaisesRegex(
zstd.ZstdError, "error when determining content size"
):
zstd.frame_content_size(b"invalid frame header")
def test_unknown(self):
cctx = zstd.ZstdCompressor(write_content_size=False)
frame = cctx.compress(b"foobar")
self.assertEqual(zstd.frame_content_size(frame), -1)
def test_empty(self):
with self.assertRaisesRegex(
zstd.ZstdError, "error when determining content size"
):
zstd.frame_content_size(b"")
def test_too_small(self):
with self.assertRaisesRegex(
zstd.ZstdError, "error when determining content size"
):
zstd.frame_content_size(b"foob")
def test_basic(self):
cctx = zstd.ZstdCompressor()
frame = cctx.compress(b"foobar")
self.assertEqual(zstd.frame_content_size(frame), 6)