Skip to content

Commit c7a314e

Browse files
committed
tests: add decompress() tests for multiple frames and extra data
Related to #59 and #181. The existing behavior isn't great. But we should at least have tests to keep us honest if/when behavior changes.
1 parent e86740d commit c7a314e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/test_decompressor_decompress.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,18 @@ def test_explicit_default_params(self):
175175
format=zstd.FORMAT_ZSTD1,
176176
)
177177
self.assertEqual(dctx.decompress(compressed), b"foo")
178+
179+
def test_multiple_frames(self):
180+
cctx = zstd.ZstdCompressor()
181+
foo = cctx.compress(b"foo")
182+
bar = cctx.compress(b"bar")
183+
184+
dctx = zstd.ZstdDecompressor()
185+
self.assertEqual(dctx.decompress(foo + bar), b"foo")
186+
187+
def test_junk_after_frame(self):
188+
cctx = zstd.ZstdCompressor()
189+
frame = cctx.compress(b"foo")
190+
191+
dctx = zstd.ZstdDecompressor()
192+
self.assertEqual(dctx.decompress(frame + b"junk"), b"foo")

0 commit comments

Comments
 (0)