test: add two new tests

pull/25/head
Pablo Castellano 2018-09-16 18:42:32 +02:00
rodzic 716ff90a4e
commit e3b3356105
1 zmienionych plików z 14 dodań i 1 usunięć

Wyświetl plik

@ -27,6 +27,12 @@ class ICalParserTests(unittest.TestCase):
self.assertTrue(type(n) == datetime, "result of now has type datetime")
self.assertTrue(n.tzinfo, "result of now has a timezone info")
def test_time_left(self):
dt = datetime(year=2017, month=2, day=2, hour=11, minute=2, tzinfo=utc)
time_left = self.eventA.time_left(time=dt)
self.assertEqual(time_left.days, 1)
self.assertEqual(time_left.seconds, 3780)
def test_event_copy_to(self):
new_start = utc.normalize(datetime(year=2017, month=2, day=5, hour=12, minute=5, tzinfo=utc))
eventC = self.eventA.copy_to(new_start)
@ -34,9 +40,16 @@ class ICalParserTests(unittest.TestCase):
self.assertNotEqual(eventC.uid, self.eventA.uid, "new event has new UID")
self.assertEqual(eventC.start, new_start, "new event has new start")
self.assertEqual(eventC.end - eventC.start, self.eventA.end - self.eventA.start, "new event has same duration")
self.assertEqual(eventC.all_day , False, "new event is no all day event")
self.assertEqual(eventC.all_day, False, "new event is no all day event")
self.assertEqual(eventC.summary, self.eventA.summary, "copy to: summary")
eventD = eventC.copy_to()
self.assertNotEqual(eventD.uid, eventC.uid, "new event has new UID")
self.assertEqual(eventD.start, eventC.start, "new event has same start")
self.assertEqual(eventD.end, eventC.end, "new event has same end")
self.assertEqual(eventD.all_day, eventC.all_day, "new event is no all day event")
self.assertEqual(eventD.summary, eventC.summary, "copy to: summary")
def test_event_order(self):
self.assertTrue(self.eventA > self.eventB, "order of events")