1616
1717@pytest .mark .parametrize ("input" , test_data )
1818def test_pyzstd_simple (input ):
19+ """
20+ Test if Zstd.[decode, encode] can perform the inverse operation to
21+ pyzstd.[compress, decompress] in the simple case.
22+ """
1923 z = Zstd ()
2024 assert z .decode (pyzstd .compress (input )) == input
2125 assert pyzstd .decompress (z .encode (input )) == input
@@ -24,18 +28,33 @@ def test_pyzstd_simple(input):
2428@pytest .mark .xfail
2529@pytest .mark .parametrize ("input" , test_data )
2630def test_pyzstd_simple_multiple_frames_decode (input ):
31+ """
32+ Test decompression of two concatenated frames of known sizes
33+
34+ numcodecs.zstd.Zstd currently fails because it only assesses the size of the
35+ first frame. Rather, it should keep iterating through all the frames until
36+ the end of the input buffer.
37+ """
2738 z = Zstd ()
39+ assert pyzstd .decompress (pyzstd .compress (input ) * 2 ) == input * 2
2840 assert z .decode (pyzstd .compress (input ) * 2 ) == input * 2
2941
3042
3143@pytest .mark .parametrize ("input" , test_data )
3244def test_pyzstd_simple_multiple_frames_encode (input ):
45+ """
46+ Test if pyzstd can decompress two concatenated frames from Zstd.encode
47+ """
3348 z = Zstd ()
3449 assert pyzstd .decompress (z .encode (input ) * 2 ) == input * 2
3550
3651
3752@pytest .mark .parametrize ("input" , test_data )
3853def test_pyzstd_streaming (input ):
54+ """
55+ Test if Zstd can decode a single frame and concatenated frames in streaming
56+ mode where the decompressed size is not recorded in the frame header.
57+ """
3958 pyzstd_c = pyzstd .ZstdCompressor ()
4059 pyzstd_d = pyzstd .ZstdDecompressor ()
4160 pyzstd_e = pyzstd .EndlessZstdDecompressor ()
0 commit comments