@@ -372,16 +372,27 @@ def test_getitem_scalar(self, data):
372
372
373
373
374
374
class TestBaseAccumulateTests (base .BaseAccumulateTests ):
375
- def check_accumulate (self , s , op_name , skipna ):
376
- result = getattr (s , op_name )(skipna = skipna ).astype ("Float64" )
377
- expected = getattr (s .astype ("Float64" ), op_name )(skipna = skipna )
375
+ def check_accumulate (self , ser , op_name , skipna ):
376
+ result = getattr (ser , op_name )(skipna = skipna )
377
+
378
+ if ser .dtype .kind == "m" :
379
+ # Just check that we match the integer behavior.
380
+ ser = ser .astype ("int64[pyarrow]" )
381
+ result = result .astype ("int64[pyarrow]" )
382
+
383
+ result = result .astype ("Float64" )
384
+ expected = getattr (ser .astype ("Float64" ), op_name )(skipna = skipna )
378
385
self .assert_series_equal (result , expected , check_dtype = False )
379
386
380
387
@pytest .mark .parametrize ("skipna" , [True , False ])
381
388
def test_accumulate_series_raises (self , data , all_numeric_accumulations , skipna ):
382
389
pa_type = data .dtype .pyarrow_dtype
383
390
if (
384
- (pa .types .is_integer (pa_type ) or pa .types .is_floating (pa_type ))
391
+ (
392
+ pa .types .is_integer (pa_type )
393
+ or pa .types .is_floating (pa_type )
394
+ or pa .types .is_duration (pa_type )
395
+ )
385
396
and all_numeric_accumulations == "cumsum"
386
397
and not pa_version_under9p0
387
398
):
@@ -423,9 +434,7 @@ def test_accumulate_series(self, data, all_numeric_accumulations, skipna, reques
423
434
raises = NotImplementedError ,
424
435
)
425
436
)
426
- elif all_numeric_accumulations == "cumsum" and (
427
- pa .types .is_duration (pa_type ) or pa .types .is_boolean (pa_type )
428
- ):
437
+ elif all_numeric_accumulations == "cumsum" and (pa .types .is_boolean (pa_type )):
429
438
request .node .add_marker (
430
439
pytest .mark .xfail (
431
440
reason = f"{ all_numeric_accumulations } not implemented for { pa_type } " ,
0 commit comments