Fix: narrow zstd compression level to the conventional -22..22 range

The raw library bounds (-131072, 22) come from an internal zstd
implementation constant (-ZSTD_TARGETLENGTH_MAX), not a meaningful
distinct level — deeper negative values than -22 buy nothing over -22
in practice, and the zstd CLI/community convention only uses -22..22.
Exposing the raw range via --zip-compression-level would let a user
pass a number like -50000 that "validates" but means nothing.
This commit is contained in:
stumpylog
2026-07-23 15:42:57 -07:00
parent e3d8bcb102
commit 5d0fb476cf
4 changed files with 14 additions and 3 deletions
@@ -78,6 +78,8 @@ class TestLevelError:
("deflated", 9),
("bzip2", 1),
("bzip2", 9),
("zstd", -22),
("zstd", 22),
("deflated", None),
("stored", None),
],
@@ -100,6 +102,8 @@ class TestLevelError:
("deflated", -1),
("bzip2", 0),
("bzip2", 10),
("zstd", -23),
("zstd", 23),
],
)
def test_out_of_range_levels_return_message(