Skip to content

Commit 4823cb7

Browse files
committed
Fix test failures with NumPy 2
* Replace deprecated `np.alltrue()` with `np.all()` (available since NumPy 1.7.0). * Cast NumPy boolean to `bool()`, to ensure doctests pass both with NumPy 2 (using `np.True_`) and NumPy 1 (using plain `True`).
1 parent 715bc6f commit 4823cb7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

blosc/toplevel.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ def compress_ptr(address, items, typesize=8, clevel=9, shuffle=blosc.SHUFFLE,
514514
items, np_array.dtype.itemsize)
515515
>>> d = blosc.decompress(c)
516516
>>> np_ans = numpy.fromstring(d, dtype=np_array.dtype)
517-
>>> (np_array == np_ans).all()
517+
>>> bool((np_array == np_ans).all())
518518
True
519519
520520
>>> import ctypes
@@ -640,7 +640,7 @@ def decompress_ptr(bytes_like, address):
640640
items, np_array.dtype.itemsize)
641641
>>> np_ans = numpy.empty(items, dtype=np_array.dtype)
642642
>>> nbytes = blosc.decompress_ptr(c, np_ans.__array_interface__['data'][0])
643-
>>> (np_array == np_ans).all()
643+
>>> bool((np_array == np_ans).all())
644644
True
645645
>>> nbytes == items * np_array.dtype.itemsize
646646
True
@@ -769,12 +769,12 @@ def unpack_array(packed_array, **kwargs):
769769
>>> len(parray) < a.size*a.itemsize
770770
True
771771
>>> a2 = blosc.unpack_array(parray)
772-
>>> numpy.alltrue(a == a2)
772+
>>> bool(numpy.all(a == a2))
773773
True
774774
>>> a = numpy.array(['å', 'ç', 'ø'])
775775
>>> parray = blosc.pack_array(a)
776776
>>> a2 = blosc.unpack_array(parray)
777-
>>> numpy.alltrue(a == a2)
777+
>>> bool(numpy.all(a == a2))
778778
True
779779
"""
780780

0 commit comments

Comments
 (0)