Skip to content

Commit 1f5670f

Browse files
committed
Fix zstd tests, coverage
1 parent 308caf3 commit 1f5670f

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

numcodecs/tests/test_pyzstd.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import pytest
2-
import numpy as np
1+
# Check Zstd against pyzstd package
32
from typing import TYPE_CHECKING
43

4+
import numpy as np
5+
import pytest
6+
57
try:
68
from numcodecs.zstd import Zstd
79
except ImportError: # pragma: no cover
@@ -16,7 +18,7 @@
1618
b"Hello World!",
1719
np.arange(113).tobytes(),
1820
np.arange(10, 15).tobytes(),
19-
np.random.randint(3, 50, size=(53,)).tobytes(),
21+
np.random.randint(3, 50, size=(53,), dtype=np.uint16).tobytes(),
2022
]
2123

2224

@@ -29,9 +31,14 @@ def test_pyzstd_simple(input):
2931

3032
@pytest.mark.xfail
3133
@pytest.mark.parametrize("input", test_data)
32-
def test_pyzstd_simple_multiple_frames(input):
34+
def test_pyzstd_simple_multiple_frames_decode(input):
3335
z = Zstd()
3436
assert z.decode(pyzstd.compress(input) * 2) == input * 2
37+
38+
39+
@pytest.mark.parametrize("input", test_data)
40+
def test_pyzstd_simple_multiple_frames_encode(input):
41+
z = Zstd()
3542
assert pyzstd.decompress(z.encode(input) * 2) == input * 2
3643

3744

numcodecs/tests/test_zstd.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import itertools
2+
import subprocess
23

34
import numpy as np
4-
import subprocess
55
import pytest
66

77
try:
@@ -99,6 +99,8 @@ def test_streaming_decompression():
9999

100100
# If the zstd command line interface is available, check the bytes
101101
cli = zstd_cli_available()
102+
if cli:
103+
view_zstd_streaming_bytes()
102104

103105
# Encode bytes directly that were the result of streaming compression
104106
bytes_val = b'(\xb5/\xfd\x00Xa\x00\x00Hello World!'

0 commit comments

Comments
 (0)