コード例 #1
0
ファイル: test_periods.py プロジェクト: Tycale/django-events
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)
コード例 #2
0
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)
コード例 #3
0
 def setUp(self):
     self.day = Day(events=Event.objects.all(),
                    date=datetime.datetime(2008, 2, 7, 9, 0))
コード例 #4
0
ファイル: test_periods.py プロジェクト: Tycale/django-events
 def setUp(self):
     self.day = Day(events=Event.objects.all(),
                        date=datetime.datetime(2008, 2, 7, 9, 0))