예제 #1
0
 def test_MultiDateBehavior(self):
     parseRDate = MultiDateBehavior.transformToNative
     self.assertEqual(
         str(parseRDate(textLineToContentLine("RDATE;VALUE=DATE:19970304,19970504,19970704,19970904"))),
         "<RDATE{'VALUE': ['DATE']}[datetime.date(1997, 3, 4), datetime.date(1997, 5, 4), datetime.date(1997, 7, 4), datetime.date(1997, 9, 4)]>"
     )
     self.assertEqual(
         str(parseRDate(textLineToContentLine("RDATE;VALUE=PERIOD:19960403T020000Z/19960403T040000Z,19960404T010000Z/PT3H"))),
         "<RDATE{'VALUE': ['PERIOD']}[(datetime.datetime(1996, 4, 3, 2, 0, tzinfo=tzutc()), datetime.datetime(1996, 4, 3, 4, 0, tzinfo=tzutc())), (datetime.datetime(1996, 4, 4, 1, 0, tzinfo=tzutc()), datetime.timedelta(0, 10800))]>"
     )
예제 #2
0
 def test_parseDTStart(self):
     """
     Should take a content line and return a datetime object.
     """
     self.assertEqual(
         parseDtstart(textLineToContentLine("DTSTART:20060509T000000")),
         datetime.datetime(2006, 5, 9, 0, 0))
예제 #3
0
 def test_parseDTStart(self):
     """
     Should take a content line and return a datetime object.
     """
     self.assertEqual(
         parseDtstart(textLineToContentLine("DTSTART:20060509T000000")),
         datetime.datetime(2006, 5, 9, 0, 0)
     )
예제 #4
0
 def test_MultiDateBehavior(self):
     parseRDate = MultiDateBehavior.transformToNative
     self.assertEqual(
         str(
             parseRDate(
                 textLineToContentLine(
                     "RDATE;VALUE=DATE:19970304,19970504,19970704,19970904")
             )),
         "<RDATE{'VALUE': ['DATE']}[datetime.date(1997, 3, 4), datetime.date(1997, 5, 4), datetime.date(1997, 7, 4), datetime.date(1997, 9, 4)]>"
     )
     self.assertEqual(
         str(
             parseRDate(
                 textLineToContentLine(
                     "RDATE;VALUE=PERIOD:19960403T020000Z/19960403T040000Z,19960404T010000Z/PT3H"
                 ))),
         "<RDATE{'VALUE': ['PERIOD']}[(datetime.datetime(1996, 4, 3, 2, 0, tzinfo=tzutc()), datetime.datetime(1996, 4, 3, 4, 0, tzinfo=tzutc())), (datetime.datetime(1996, 4, 4, 1, 0, tzinfo=tzutc()), datetime.timedelta(0, 10800))]>"
     )