def test_accumulate__end_date(padding,sample_key,delta): sd = sample_data[sample_key] ts = TimeSeries(sd) original_len = len(ts.data) ts.accumulate(delta,"Day",padding=padding) assert(ts.get_x()[-1]==expected_end_date(sd[-1][0],delta,original_len,padding))
def test_accumulate__empty(): #It should be possible to initialize with an empty list ts = TimeSeries([]) ts.accumulate(2) assert(ts.data==[])
def test_accumulate__steps(padding,sample_key,delta): ts = TimeSeries(sample_data[sample_key]) ts.accumulate(delta,"Day",padding=padding) for i in range(1,len(ts.data)): assert((ts.data[i][0]-ts.data[i-1][0]).days == delta)