示例#1
0
 def test_count(self):
     vevent = _get_vevent(vevent_count)
     dtstart = datetimehelper.expand(vevent, berlin)
     starts = [start for start, _ in dtstart]
     assert len(starts) == 18
     assert dtstart[0][0] == datetime.datetime(2014, 2, 3, 7, 0)
     assert dtstart[-1][0] == datetime.datetime(2014, 2, 20, 7, 0)
示例#2
0
 def test_another_problem(self):
     vevent = _get_vevent(another_problem)
     dtstart = datetimehelper.expand(vevent, berlin)
     assert dtstart[0][0] == berlin.localize(
         datetime.datetime(2013, 11, 13, 19, 0))
     assert dtstart[-1][0] == berlin.localize(
         datetime.datetime(2028, 11, 8, 19, 0))
示例#3
0
 def test_until_d_notz(self):
     vevent = _get_vevent(event_until_d_notz)
     dtstart = datetimehelper.expand(vevent, berlin)
     starts = [start for start, _ in dtstart]
     assert len(starts) == 6
     assert dtstart[0][0] == datetime.date(2014, 1, 10)
     assert dtstart[-1][0] == datetime.date(2014, 2, 14)
示例#4
0
 def test_another_problem(self):
     vevent = _get_vevent(another_problem)
     dtstart = datetimehelper.expand(vevent, berlin)
     assert dtstart[0][0] == berlin.localize(
         datetime.datetime(2013, 11, 13, 19, 0))
     assert dtstart[-1][0] == berlin.localize(
         datetime.datetime(2028, 11, 8, 19, 0))
示例#5
0
 def test_count(self):
     vevent = _get_vevent(vevent_count)
     dtstart = datetimehelper.expand(vevent, berlin)
     starts = [start for start, _ in dtstart]
     assert len(starts) == 18
     assert dtstart[0][0] == datetime.datetime(2014, 2, 3, 7, 0)
     assert dtstart[-1][0] == datetime.datetime(2014, 2, 20, 7, 0)
示例#6
0
 def test_until_d_notz(self):
     vevent = _get_vevent(event_until_d_notz)
     dtstart = datetimehelper.expand(vevent, berlin)
     starts = [start for start, _ in dtstart]
     assert len(starts) == 6
     assert dtstart[0][0] == datetime.date(2014, 1, 10)
     assert dtstart[-1][0] == datetime.date(2014, 2, 14)
示例#7
0
 def test_expand_d(self):
     vevent = _get_vevent(event_d_norr)
     dtstart = datetimehelper.expand(vevent, berlin)
     assert dtstart == [
         (datetime.date(2013, 3, 1,),
          datetime.date(2013, 3, 2,)),
     ]
示例#8
0
 def test_expand_dtb(self):
     vevent = _get_vevent(event_dtb_norr)
     dtstart = datetimehelper.expand(vevent, berlin)
     assert dtstart == self.dtstartend_berlin
     assert [start.utcoffset()
             for start, _ in dtstart] == self.offset_berlin
     assert [end.utcoffset() for _, end in dtstart] == self.offset_berlin
示例#9
0
 def test_expand_dtb(self):
     vevent = _get_vevent(event_dtb_norr)
     dtstart = datetimehelper.expand(vevent, berlin)
     assert dtstart == self.dtstartend_berlin
     assert [start.utcoffset()
             for start, _ in dtstart] == self.offset_berlin
     assert [end.utcoffset() for _, end in dtstart] == self.offset_berlin
示例#10
0
 def test_expand_d(self):
     vevent = _get_vevent(event_d_norr)
     dtstart = datetimehelper.expand(vevent, berlin)
     assert dtstart == [
         (datetime.date(2013, 3, 1,),
          datetime.date(2013, 3, 2,)),
     ]
示例#11
0
 def test_event_exdatesl_dt(self):
     """recurring event, three dates exclude via two EXCLUDEs"""
     vevent = _get_vevent(event_exdatesl_dt)
     dtstart = datetimehelper.expand(vevent, berlin)
     assert len(dtstart) == 7
     assert dtstart[0][0] == berlin.localize(
         datetime.datetime(2014, 7, 2, 19, 0))
     assert dtstart[-1][0] == berlin.localize(
         datetime.datetime(2014, 7, 11, 19, 0))
示例#12
0
 def test_until_notz(self):
     vevent = _get_vevent(vevent_until_notz)
     dtstart = datetimehelper.expand(vevent, berlin)
     starts = [start for start, _ in dtstart]
     assert len(starts) == 18
     assert dtstart[0][0] == berlin.localize(
         datetime.datetime(2014, 2, 3, 7, 0))
     assert dtstart[-1][0] == berlin.localize(
         datetime.datetime(2014, 2, 20, 7, 0))
示例#13
0
 def test_event_exdatesl_dt(self):
     """recurring event, three dates exclude via two EXCLUDEs"""
     vevent = _get_vevent(event_exdatesl_dt)
     dtstart = datetimehelper.expand(vevent, berlin)
     assert len(dtstart) == 7
     assert dtstart[0][0] == berlin.localize(
         datetime.datetime(2014, 7, 2, 19, 0))
     assert dtstart[-1][0] == berlin.localize(
         datetime.datetime(2014, 7, 11, 19, 0))
示例#14
0
 def test_until_notz(self):
     vevent = _get_vevent(vevent_until_notz)
     dtstart = datetimehelper.expand(vevent, berlin)
     starts = [start for start, _ in dtstart]
     assert len(starts) == 18
     assert dtstart[0][0] == berlin.localize(
         datetime.datetime(2014, 2, 3, 7, 0))
     assert dtstart[-1][0] == berlin.localize(
         datetime.datetime(2014, 2, 20, 7, 0))
示例#15
0
    def test_expand_dtr_exdatez(self):
        """a recurring event with an EXDATE in Zulu time while DTSTART is
        localized"""
        vevent = _get_vevent("""BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
UID:event_dtr_exdatez
SUMMARY:event_dtr_exdatez
RRULE:FREQ=WEEKLY;UNTIL=20140725T053000Z
EXDATE:20140721T053000Z
DTSTART;TZID=Europe/Berlin:20140630T073000
DURATION:PT4H30M
END:VEVENT
END:VCALENDAR""")
        dtstart = datetimehelper.expand(vevent, berlin)
        assert len(dtstart) == 3
示例#16
0
 def test_simple_rdate(self):
     vevent = _get_vevent(simple_rdate)
     dtstart = datetimehelper.expand(vevent, berlin)
     assert len(dtstart) == 4
示例#17
0
 def test_latest_bug(self):
     vevent = _get_vevent(latest_bug)
     dtstart = datetimehelper.expand(vevent, berlin)
     assert dtstart[0][0] == datetime.date(2009, 10, 31)
     assert dtstart[-1][0] == datetime.date(2023, 10, 31)
示例#18
0
 def test_latest_bug(self):
     vevent = _get_vevent(latest_bug)
     dtstart = datetimehelper.expand(vevent, berlin)
     assert dtstart[0][0] == datetime.date(2009, 10, 31)
     assert dtstart[-1][0] == datetime.date(2023, 10, 31)
示例#19
0
 def test_simple_rdate(self):
     vevent = _get_vevent(simple_rdate)
     dtstart = datetimehelper.expand(vevent, berlin)
     assert len(dtstart) == 4
示例#20
0
 def test_expand_dtzb(self):
     vevent = _get_vevent(event_dtzb)
     dtstart = datetimehelper.expand(vevent, berlin)
     assert dtstart == self.dstartend
示例#21
0
 def test_expand_dtzb(self):
     vevent = _get_vevent(event_dtzb)
     dtstart = datetimehelper.expand(vevent, berlin)
     assert dtstart == self.dstartend
示例#22
0
 def test_rrule_and_rdate(self):
     vevent = _get_vevent(rrule_and_rdate)
     dtstart = datetimehelper.expand(vevent, berlin)
     assert len(dtstart) == 7
示例#23
0
 def test_rrule_and_rdate(self):
     vevent = _get_vevent(rrule_and_rdate)
     dtstart = datetimehelper.expand(vevent, berlin)
     assert len(dtstart) == 7