23
23
pytest .importorskip ('pyarrow' , minversion = "0.10.0" )
24
24
25
25
from pandas .core .arrays .mask ._pyarrow import ( # isort:skip
26
- ArrowBoolArray , ArrowBoolDtype )
26
+ ArrowMaskArray , ArrowMaskDtype )
27
27
28
28
29
29
@pytest .fixture
30
30
def dtype ():
31
- return ArrowBoolDtype ()
31
+ return ArrowMaskDtype ()
32
32
33
33
34
34
@pytest .fixture
35
35
def data ():
36
- return ArrowBoolArray .from_scalars (np . random . randint ( 0 , 2 , size = 100 ,
37
- dtype = bool ))
36
+ return ArrowMaskArray .from_scalars (
37
+ np . random . randint ( 0 , 2 , size = 100 , dtype = bool ))
38
38
39
39
40
40
@pytest .fixture
41
41
def data_missing ():
42
- return ArrowBoolArray .from_scalars ([None , True ])
42
+ return ArrowMaskArray .from_scalars ([None , True ])
43
43
44
44
45
45
class BaseArrowTests (object ):
@@ -64,14 +64,23 @@ def test_from_dtype(self, data):
64
64
class TestReduceBoolean (base .BaseBooleanReduceTests ):
65
65
66
66
@pytest .mark .parametrize ('skipna' , [True , False ])
67
- def test_reduce_series_numeric (
68
- self , data , all_numeric_reductions_for_boolean , skipna ):
69
- op_name = all_numeric_reductions_for_boolean
67
+ def test_reduce_series (
68
+ self , data , only_numeric_reductions , skipna ):
69
+ op_name = only_numeric_reductions
70
70
s = pd .Series (data )
71
-
72
71
with pytest .raises (TypeError ):
73
72
getattr (s , op_name )(skipna = skipna )
74
73
74
+ @pytest .mark .parametrize ('skipna' , [True , False ])
75
+ def test_reduce_series_non_numeric (
76
+ self , data , only_non_numeric_reductions , skipna ):
77
+ op_name = only_non_numeric_reductions
78
+ s = pd .Series (data )
79
+ if op_name == 'sum' :
80
+ self .check_reduce (s , op_name , skipna )
81
+ else :
82
+ self .check_reduce_bool (s , op_name , skipna )
83
+
75
84
76
85
def test_is_bool_dtype (data ):
77
86
assert pd .api .types .is_bool_dtype (data )
0 commit comments