1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
From: Antonio Valentino <antonio.valentino@tiscali.it>
Date: Sat, 14 Feb 2026 18:32:21 +0000
Subject: Prefer zstd from stdlib
Forwarded: https://github.com/zarr-developers/numcodecs/pull/818
---
numcodecs/tests/test_pyzstd.py | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/numcodecs/tests/test_pyzstd.py b/numcodecs/tests/test_pyzstd.py
index 7ee6084..bb126d0 100644
--- a/numcodecs/tests/test_pyzstd.py
+++ b/numcodecs/tests/test_pyzstd.py
@@ -2,7 +2,13 @@
import numpy as np
import pytest
-import pyzstd
+try:
+ from compression import zstd as pyzstd
+except ImportError:
+ try:
+ from backports import zstd as pyzstd
+ except ImportError:
+ import pyzstd
from numcodecs.zstd import Zstd
@@ -56,7 +62,7 @@ def test_pyzstd_streaming(input):
"""
pyzstd_c = pyzstd.ZstdCompressor()
pyzstd_d = pyzstd.ZstdDecompressor()
- pyzstd_e = pyzstd.EndlessZstdDecompressor()
+ # pyzstd_e = pyzstd.EndlessZstdDecompressor()
z = Zstd()
d_bytes = input
@@ -66,11 +72,11 @@ def test_pyzstd_streaming(input):
assert pyzstd_d.decompress(z.encode(d_bytes)) == d_bytes
# Test multiple streaming frames
- assert z.decode(c_bytes * 2) == pyzstd_e.decompress(c_bytes * 2)
- assert z.decode(c_bytes * 3) == pyzstd_e.decompress(c_bytes * 3)
- assert z.decode(c_bytes * 4) == pyzstd_e.decompress(c_bytes * 4)
- assert z.decode(c_bytes * 5) == pyzstd_e.decompress(c_bytes * 5)
- assert z.decode(c_bytes * 7) == pyzstd_e.decompress(c_bytes * 7)
- assert z.decode(c_bytes * 11) == pyzstd_e.decompress(c_bytes * 11)
- assert z.decode(c_bytes * 13) == pyzstd_e.decompress(c_bytes * 13)
- assert z.decode(c_bytes * 99) == pyzstd_e.decompress(c_bytes * 99)
+ assert z.decode(c_bytes * 2) == pyzstd.decompress(c_bytes * 2)
+ assert z.decode(c_bytes * 3) == pyzstd.decompress(c_bytes * 3)
+ assert z.decode(c_bytes * 4) == pyzstd.decompress(c_bytes * 4)
+ assert z.decode(c_bytes * 5) == pyzstd.decompress(c_bytes * 5)
+ assert z.decode(c_bytes * 7) == pyzstd.decompress(c_bytes * 7)
+ assert z.decode(c_bytes * 11) == pyzstd.decompress(c_bytes * 11)
+ assert z.decode(c_bytes * 13) == pyzstd.decompress(c_bytes * 13)
+ assert z.decode(c_bytes * 99) == pyzstd.decompress(c_bytes * 99)
|