Skip to content

Commit 7fe0dd8

Browse files
committed
(fix): test internal compress error
1 parent a421c5b commit 7fe0dd8

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

numcodecs/blosc.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def compress(source, char* cname, int clevel, int shuffle=SHUFFLE,
280280
source_ptr = source_buffer.ptr
281281
nbytes = source_buffer.nbytes
282282
if isinstance(typesize, int):
283-
if typesize < 1: # pragma: no cover
283+
if typesize < 1:
284284
raise ValueError(f"Cannot use typesize {typesize} less than 1.")
285285
itemsize = typesize
286286
else:

numcodecs/tests/test_blosc.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,3 +290,9 @@ def test_typesize_explicit():
290290
def test_typesize_less_than_1():
291291
with pytest.raises(ValueError, match=r"Cannot use typesize"):
292292
Blosc(shuffle=Blosc.SHUFFLE, typesize=0)
293+
compressor = Blosc(shuffle=Blosc.SHUFFLE)
294+
# not really something that should be done in practice, but good for testing.
295+
compressor.typesize = 0
296+
arr = np.arange(100)
297+
with pytest.raises(ValueError, match=r"Cannot use typesize"):
298+
compressor.encode(arr.tobytes())

0 commit comments

Comments
 (0)