Example #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)
Example #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))
Example #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)
Example #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))
Example #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)
Example #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)
Example #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,)),
     ]
Example #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
Example #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
Example #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,)),
     ]
Example #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))
Example #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))
Example #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))
Example #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))
Example #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
Example #16
0
 def test_simple_rdate(self):
     vevent = _get_vevent(simple_rdate)
     dtstart = datetimehelper.expand(vevent, berlin)
     assert len(dtstart) == 4
Example #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)
Example #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)
Example #19
0
 def test_simple_rdate(self):
     vevent = _get_vevent(simple_rdate)
     dtstart = datetimehelper.expand(vevent, berlin)
     assert len(dtstart) == 4
Example #20
0
 def test_expand_dtzb(self):
     vevent = _get_vevent(event_dtzb)
     dtstart = datetimehelper.expand(vevent, berlin)
     assert dtstart == self.dstartend
Example #21
0
 def test_expand_dtzb(self):
     vevent = _get_vevent(event_dtzb)
     dtstart = datetimehelper.expand(vevent, berlin)
     assert dtstart == self.dstartend
Example #22
0
 def test_rrule_and_rdate(self):
     vevent = _get_vevent(rrule_and_rdate)
     dtstart = datetimehelper.expand(vevent, berlin)
     assert len(dtstart) == 7
Example #23
0
 def test_rrule_and_rdate(self):
     vevent = _get_vevent(rrule_and_rdate)
     dtstart = datetimehelper.expand(vevent, berlin)
     assert len(dtstart) == 7