class TestDay(TestCase): def setUp(self): self.day = Day(events=Event.objects.all(), date=datetime.datetime(2008, 2, 7, 9, 0)) def test_day_setup(self): self.assertEqual(self.day.start, datetime.datetime(2008, 2, 7, 0, 0)) self.assertEqual(self.day.end, datetime.datetime(2008, 2, 8, 0, 0)) def test_day_convenience_functions(self): self.assertEqual(self.day.prev_day().start, datetime.datetime(2008, 2, 6, 0, 0)) self.assertEqual(self.day.next_day().start, datetime.datetime(2008, 2, 8, 0, 0)) def test_time_slot(self): slot_start = datetime.datetime(2008, 2, 7, 13, 30) slot_end = datetime.datetime(2008, 2, 7, 15, 0) period = self.day.get_time_slot(slot_start, slot_end) self.assertEqual(period.start, slot_start) self.assertEqual(period.end, slot_end)
def setUp(self): self.day = Day(events=Event.objects.all(), date=datetime.datetime(2008, 2, 7, 9, 0))