| 
13 | 13 |     pyzstd = pytest.importorskip("pyzstd")  | 
14 | 14 | 
 
  | 
15 | 15 | test_data = [  | 
16 |  | -        b"Hello World!",  | 
17 |  | -        np.arange(113).tobytes(),  | 
18 |  | -        np.arange(10,15).tobytes(),  | 
19 |  | -        np.random.randint(3, 50, size=(53,)).tobytes()  | 
 | 16 | +    b"Hello World!",  | 
 | 17 | +    np.arange(113).tobytes(),  | 
 | 18 | +    np.arange(10, 15).tobytes(),  | 
 | 19 | +    np.random.randint(3, 50, size=(53,)).tobytes(),  | 
20 | 20 | ]  | 
21 | 21 | 
 
  | 
 | 22 | + | 
22 | 23 | @pytest.mark.parametrize("input", test_data)  | 
23 | 24 | def test_pyzstd_simple(input):  | 
24 | 25 |     z = Zstd()  | 
25 | 26 |     assert z.decode(pyzstd.compress(input)) == input  | 
26 | 27 |     assert pyzstd.decompress(z.encode(input)) == input  | 
27 | 28 | 
 
  | 
 | 29 | + | 
28 | 30 | @pytest.mark.xfail  | 
29 | 31 | @pytest.mark.parametrize("input", test_data)  | 
30 | 32 | def test_pyzstd_simple_multiple_frames(input):  | 
31 | 33 |     z = Zstd()  | 
32 |  | -    assert z.decode(pyzstd.compress(input)*2) == input*2  | 
33 |  | -    assert pyzstd.decompress(z.encode(input)*2) == input*2  | 
 | 34 | +    assert z.decode(pyzstd.compress(input) * 2) == input * 2  | 
 | 35 | +    assert pyzstd.decompress(z.encode(input) * 2) == input * 2  | 
 | 36 | + | 
34 | 37 | 
 
  | 
35 | 38 | @pytest.mark.parametrize("input", test_data)  | 
36 | 39 | def test_pyzstd_streaming(input):  | 
37 | 40 |     pyzstd_c = pyzstd.ZstdCompressor()  | 
38 | 41 |     pyzstd_d = pyzstd.ZstdDecompressor()  | 
39 | 42 |     z = Zstd()  | 
40 |  | -      | 
 | 43 | + | 
41 | 44 |     d_bytes = input  | 
42 | 45 |     pyzstd_c.compress(d_bytes)  | 
43 | 46 |     c_bytes = pyzstd_c.flush()  | 
44 | 47 |     assert z.decode(c_bytes) == d_bytes  | 
45 | 48 |     assert pyzstd_d.decompress(z.encode(d_bytes)) == d_bytes  | 
46 | 49 | 
 
  | 
47 | 50 |     # Test multiple streaming frames  | 
48 |  | -    assert z.decode(c_bytes*2) == d_bytes*2  | 
49 |  | -    assert z.decode(c_bytes*3) == d_bytes*3  | 
50 |  | -    assert z.decode(c_bytes*99) == d_bytes*99  | 
 | 51 | +    assert z.decode(c_bytes * 2) == d_bytes * 2  | 
 | 52 | +    assert z.decode(c_bytes * 3) == d_bytes * 3  | 
 | 53 | +    assert z.decode(c_bytes * 99) == d_bytes * 99  | 
0 commit comments