Skip to content

Commit f4dbdf0

Browse files
committed
test: add test cases for compress function in utils
1 parent c630db9 commit f4dbdf0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/test_utils.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import numpy as np
12
import pytest
23
import iscc_sci.utils
34

@@ -16,3 +17,11 @@ def test_check_integrity_failure(img_path):
1617
with pytest.raises(RuntimeError) as exc_info:
1718
iscc_sci.utils.check_integrity(img_path, wrong_checksum)
1819
assert "Failed integrity check" in str(exc_info.value)
20+
21+
22+
def test_compress():
23+
arr1 = np.array([3.0, 15294.7789, 32977.7])
24+
arr2 = np.array([3.0, 15294.7789, 32977.7], dtype=np.float32)
25+
expected = [3.0, 15294.8, 32977.7]
26+
assert iscc_sci.compress(arr1, 1) == expected
27+
assert iscc_sci.compress(arr2, 1) == expected

0 commit comments

Comments
 (0)