Skip to content

Commit a3579a0

Browse files
committed
codecov
1 parent 0375c55 commit a3579a0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

numcodecs/tests/test_crc32c.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ def test_checksum():
4040
assert np.frombuffer(buf, dtype="<u4", offset=(len(buf) - 4))[0] == np.uint32(4218238699)
4141

4242

43+
def test_err_checksum():
44+
arr = np.arange(0, 64, dtype="uint8")
45+
buf = bytearray(Crc32c().encode(arr))
46+
buf[-1] = 0 # corrupt the checksum
47+
with pytest.raises(ValueError):
48+
Crc32c().decode(buf)
49+
50+
4351
def test_repr():
4452
check_repr("Crc32c()")
4553

@@ -73,6 +81,12 @@ def test_err_encode_non_contiguous():
7381
Crc32c().encode(arr)
7482

7583

84+
def test_err_input_too_small():
85+
buf = b'000' # 3 bytes are too little for a CRC32C checksum
86+
with pytest.raises(ValueError):
87+
Crc32c().decode(buf)
88+
89+
7690
def test_err_out_too_small():
7791
arr = np.arange(10, dtype='i4')
7892
out = np.empty_like(arr)[:-1]

0 commit comments

Comments
 (0)