Skip to content

Commit 7ef6329

Browse files
committed
Fix tests when where is None
1 parent b66ad84 commit 7ef6329

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/blosc2/ndarray.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,8 @@ def sum(
593593
>>> print("Sum along axis 0 (columns):", sum_axis_0)
594594
Sum along axis 0 (columns): [5 7 9]
595595
"""
596+
if where is None:
597+
return ndarr.sum(axis=axis, dtype=dtype, keepdims=keepdims, **kwargs)
596598
return ndarr.sum(axis=axis, dtype=dtype, keepdims=keepdims, where=where, **kwargs)
597599

598600

@@ -702,6 +704,8 @@ def mean(
702704
>>> print("Mean of all elements:", overall_mean)
703705
Mean of all elements: 3.5
704706
"""
707+
if where is None:
708+
return ndarr.mean(axis=axis, dtype=dtype, keepdims=keepdims, **kwargs)
705709
return ndarr.mean(axis=axis, dtype=dtype, keepdims=keepdims, where=where, **kwargs)
706710

707711

@@ -767,6 +771,8 @@ def std(
767771
>>> print("Standard deviation along axis 0:", std_axis0)
768772
Standard deviation along axis 0: [1.5 1.5 1.5]
769773
"""
774+
if where is None:
775+
return ndarr.std(axis=axis, dtype=dtype, ddof=ddof, keepdims=keepdims, **kwargs)
770776
return ndarr.std(axis=axis, dtype=dtype, ddof=ddof, keepdims=keepdims, where=where, **kwargs)
771777

772778

@@ -810,6 +816,8 @@ def var(
810816
>>> print("Variance along axis 0:", var_axis0)
811817
Variance along axis 0: [2.25 2.25 2.25]
812818
"""
819+
if where is None:
820+
return ndarr.var(axis=axis, dtype=dtype, ddof=ddof, keepdims=keepdims, **kwargs)
813821
return ndarr.var(axis=axis, dtype=dtype, ddof=ddof, keepdims=keepdims, where=where, **kwargs)
814822

815823

@@ -851,6 +859,8 @@ def prod(
851859
>>> print("Product along axis 1:", prod_axis1)
852860
Product along axis 1: [7986 2160]
853861
"""
862+
if where is None:
863+
return ndarr.prod(axis=axis, dtype=dtype, keepdims=keepdims, **kwargs)
854864
return ndarr.prod(axis=axis, dtype=dtype, keepdims=keepdims, where=where, **kwargs)
855865

856866

@@ -905,6 +915,8 @@ def min(
905915
>>> print("Minimum along axis 0 with keepdims=True:", min_keepdims)
906916
Minimum along axis 0 with keepdims=True: [1]
907917
"""
918+
if where is None:
919+
return ndarr.min(axis=axis, keepdims=keepdims, **kwargs)
908920
return ndarr.min(axis=axis, keepdims=keepdims, where=where, **kwargs)
909921

910922

@@ -949,6 +961,8 @@ def max(
949961
>>> print("Maximum of the flattened array:", max_flattened)
950962
Maximum of the flattened array: 81
951963
"""
964+
if where is None:
965+
return ndarr.max(axis=axis, keepdims=keepdims, **kwargs)
952966
return ndarr.max(axis=axis, keepdims=keepdims, where=where, **kwargs)
953967

954968

0 commit comments

Comments
 (0)