@@ -167,11 +167,17 @@ class TestDataFrameAnalytics:
167
167
pytest .param ("kurt" , marks = td .skip_if_no_scipy ),
168
168
],
169
169
)
170
- def test_stat_op_api_float_string_frame (self , float_string_frame , axis , opname ):
171
- if (opname in ("sum" , "min" , "max" ) and axis == 0 ) or opname in (
172
- "count" ,
173
- "nunique" ,
174
- ):
170
+ def test_stat_op_api_float_string_frame (
171
+ self , float_string_frame , axis , opname , using_infer_string
172
+ ):
173
+ if (
174
+ (opname in ("sum" , "min" , "max" ) and axis == 0 )
175
+ or opname
176
+ in (
177
+ "count" ,
178
+ "nunique" ,
179
+ )
180
+ ) and not (using_infer_string and opname == "sum" ):
175
181
getattr (float_string_frame , opname )(axis = axis )
176
182
else :
177
183
if opname in ["var" , "std" , "sem" , "skew" , "kurt" ]:
@@ -197,7 +203,11 @@ def test_stat_op_api_float_string_frame(self, float_string_frame, axis, opname):
197
203
elif opname in ["min" , "max" ]:
198
204
msg = "'[><]=' not supported between instances of 'float' and 'str'"
199
205
elif opname == "median" :
200
- msg = re .compile (r"Cannot convert \[.*\] to numeric" , flags = re .S )
206
+ msg = re .compile (
207
+ r"Cannot convert \[.*\] to numeric|does not support" , flags = re .S
208
+ )
209
+ if not isinstance (msg , re .Pattern ):
210
+ msg = msg + "|does not support"
201
211
with pytest .raises (TypeError , match = msg ):
202
212
getattr (float_string_frame , opname )(axis = axis )
203
213
if opname != "nunique" :
@@ -358,6 +368,7 @@ def test_mixed_ops(self, op):
358
368
"Could not convert" ,
359
369
"could not convert" ,
360
370
"can't multiply sequence by non-int" ,
371
+ "does not support" ,
361
372
]
362
373
)
363
374
with pytest .raises (TypeError , match = msg ):
@@ -369,6 +380,7 @@ def test_mixed_ops(self, op):
369
380
"Could not convert" ,
370
381
"could not convert" ,
371
382
"can't multiply sequence by non-int" ,
383
+ "does not support" ,
372
384
]
373
385
)
374
386
with pytest .raises (TypeError , match = msg ):
@@ -887,7 +899,8 @@ def test_sum_mixed_datetime(self):
887
899
888
900
def test_mean_corner (self , float_frame , float_string_frame ):
889
901
# unit test when have object data
890
- with pytest .raises (TypeError , match = "Could not convert" ):
902
+ msg = "Could not convert|does not support"
903
+ with pytest .raises (TypeError , match = msg ):
891
904
float_string_frame .mean (axis = 0 )
892
905
893
906
# xs sum mixed type, just want to know it works...
0 commit comments