def test_compactor_can_generate_final_shift(self): self.assert_equals(timedelta(), ValuesPerTimeCompactor.final_shift([])) self.assert_equals(timedelta(days=1), ValuesPerTimeCompactor.final_shift([self.today])) self.assert_equals(timedelta(days=2), ValuesPerTimeCompactor.final_shift([self.yesterday, self.tomorrow]))
def _compact_values(self, timed_values, days_to_remove): compactor = ValuesPerTimeCompactor(timed_values, days_to_remove) return compactor.compact_values()