@@ -343,6 +343,54 @@ def test_getitem_scalar(self, data):
343
343
super ().test_getitem_scalar (data )
344
344
345
345
346
+ class TestBaseAccumulateTests (base .BaseAccumulateTests ):
347
+ def check_accumulate (self , s , op_name , skipna ):
348
+ result = getattr (s , op_name )(skipna = skipna ).astype ("Float64" )
349
+ expected = getattr (s .astype ("Float64" ), op_name )(skipna = skipna )
350
+ self .assert_series_equal (result , expected , check_dtype = False )
351
+
352
+ @pytest .mark .parametrize ("skipna" , [True , False ])
353
+ def test_accumulate_series_raises (
354
+ self , data , all_numeric_accumulations , skipna , request
355
+ ):
356
+ pa_type = data .dtype .pyarrow_dtype
357
+ if (
358
+ (pa .types .is_integer (pa_type ) or pa .types .is_floating (pa_type ))
359
+ and all_numeric_accumulations == "cumsum"
360
+ and not pa_version_under9p0
361
+ ):
362
+ request .node .add_marker (
363
+ pytest .mark .xfail (
364
+ reason = f"{ all_numeric_accumulations } implemented for { pa_type } "
365
+ )
366
+ )
367
+ op_name = all_numeric_accumulations
368
+ ser = pd .Series (data )
369
+
370
+ with pytest .raises (NotImplementedError ):
371
+ getattr (ser , op_name )(skipna = skipna )
372
+
373
+ @pytest .mark .parametrize ("skipna" , [True , False ])
374
+ def test_accumulate_series (self , data , all_numeric_accumulations , skipna , request ):
375
+ pa_type = data .dtype .pyarrow_dtype
376
+ if all_numeric_accumulations != "cumsum" or pa_version_under9p0 :
377
+ request .node .add_marker (
378
+ pytest .mark .xfail (
379
+ reason = f"{ all_numeric_accumulations } not implemented" ,
380
+ raises = NotImplementedError ,
381
+ )
382
+ )
383
+ elif not (pa .types .is_integer (pa_type ) or pa .types .is_floating (pa_type )):
384
+ request .node .add_marker (
385
+ pytest .mark .xfail (
386
+ reason = f"{ all_numeric_accumulations } not implemented for { pa_type } "
387
+ )
388
+ )
389
+ op_name = all_numeric_accumulations
390
+ ser = pd .Series (data )
391
+ self .check_accumulate (ser , op_name , skipna )
392
+
393
+
346
394
class TestBaseNumericReduce (base .BaseNumericReduceTests ):
347
395
def check_reduce (self , ser , op_name , skipna ):
348
396
pa_dtype = ser .dtype .pyarrow_dtype
0 commit comments