Skip to content

Commit f1d7c0e

Browse files
authored
Fix Fletcher32 out and test (#449)
1 parent 63e820e commit f1d7c0e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

numcodecs/fletcher32.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class Fletcher32(Codec):
7979
f" match the expected checksum ({found}).\n"
8080
"This could be a sign that the data has been corrupted."
8181
)
82-
if out:
82+
if out is not None:
8383
out.view("uint8")[:] = b[:-4]
8484
return out
8585
return memoryview(b[:-4])

numcodecs/tests/test_fletcher32.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,10 @@ def test_known():
4040
1911, -2427, 1897, -2412, 2440, 873, -621, -829, 551, -2118,
4141
]
4242
assert outarr.tolist() == expected
43+
44+
45+
def test_out():
46+
data = np.frombuffer(bytearray(b"Hello World"), dtype="uint8")
47+
f = Fletcher32()
48+
result = f.encode(data)
49+
f.decode(result, out=data)

0 commit comments

Comments
 (0)