Alle Dateien aus dem Pythonkurs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

19 lines
647 B

import pytest
import pandas._testing as tm
from pandas.core.arrays import TimedeltaArray
class TestAccumulator:
def test_accumulators_disallowed(self):
# GH#50297
arr = TimedeltaArray._from_sequence_not_strict(["1D", "2D"])
with pytest.raises(TypeError, match="cumprod not supported"):
arr._accumulate("cumprod")
def test_cumsum(self):
# GH#50297
arr = TimedeltaArray._from_sequence_not_strict(["1D", "2D"])
result = arr._accumulate("cumsum")
expected = TimedeltaArray._from_sequence_not_strict(["1D", "3D"])
tm.assert_timedelta_array_equal(result, expected)