Exemplo n.º 1
0
 def test_start_of_period(self):
     year, month, day = 2010, 8, 17
     time = date(year, month, day)
     start_day = date(year, month, day)
     start_week = date(year, month, 16)
     start_month = date(year, month, 1)
     adp = DataPoint()
     self.failUnlessEqual(adp._start_of_period("D",time), start_day)
     self.failUnlessEqual(adp._start_of_period("W",time), start_week)
     self.failUnlessEqual(adp._start_of_period("M",time), start_month)
Exemplo n.º 2
0
 def test_checkin_at_midnight(self):
     date_midnight = date(2010, 10, 12)
     c = CheckIn(number=10, when=date_midnight)
     dp = DataPoint(start=date_midnight, accumulation_period="D");
     dp.add_checkin(c)
     self.failUnlessEqual(10, dp.number)
Exemplo n.º 3
0
 def test_datapoint_add_checkin_outside_period(self):
     when = date(2010, 10, 10)
     c = CheckIn(number=10, when=when)
     adp = DataPoint(start=when - timedelta(1), accumulation_period="D")
     adp.add_checkin(c)
     self.failUnlessEqual(0, adp.number)