def test__different_timedelta(self): t = Timeframe(pd_start_date=pd_ts('2017-01-01 1:00'), pd_end_date=pd_ts('2017-01-01 1:35'), pd_interval=pandas.Timedelta(minutes=15)) t.add_timedelta() self.assertEqual(t.date(), pd_ts('2017-01-01 1:15')) t.add_timedelta() self.assertEqual(t.date(), pd_ts('2017-01-01 1:30')) self.assertEqual(t.finished(), False) t.add_timedelta() self.assertEqual(t.finished(), True) self.assertEqual(t.date(), pd_ts('2017-01-01 1:35'))
def test__add_timedelta__date(self): t = Timeframe(pd_start_date=pd_ts('2017-01-01 1:00'), pd_end_date=pd_ts('2017-01-01 1:03'), pd_interval=pandas.Timedelta(minutes=1)) self.assertEqual(t.date(), pd_ts('2017-01-01 1:00')) # should return the same value self.assertEqual(t.date(), pd_ts('2017-01-01 1:00')) t.add_timedelta() self.assertEqual(t.date(), pd_ts('2017-01-01 1:01')) t.add_timedelta() t.add_timedelta() self.assertEqual(t.date(), pd_ts('2017-01-01 1:03')) self.assertEqual(t.finished(), False) t.add_timedelta() self.assertEqual(t.finished(), True) self.assertEqual(t.date(), pd_ts('2017-01-01 1:03'))