def test_every_week_20_times(self): """Repeat every week for 20 times.""" vrecurr = utils.build_rrule(freq="WEEKLY", count=20) assert vrecurr["FREQ"] == "WEEKLY" assert vrecurr["COUNT"] == 20 vRecur(vrecurr).to_ical().decode() == "FREQ=WEEKLY;COUNT=20" assert len(vrecurr.keys()) == 2
def test_ever_month_last_mo(self): """Repeat every month on the last Monday.""" vrecurr = utils.build_rrule(freq="MONTHLY", byday="-1MO") assert vrecurr["FREQ"] == "MONTHLY" assert vrecurr["BYDAY"] == "-1MO" vRecur(vrecurr).to_ical().decode() == "FREQ=MONTHLY;BYDAY=-1MO" assert len(vrecurr.keys()) == 2
def test_ever_month_last_day(self): """Repeat the last day of each month.""" vrecurr = utils.build_rrule(freq="MONTHLY", bymonthday=-1) assert vrecurr["FREQ"] == "MONTHLY" assert vrecurr["BYMONTHDAY"] == -1 vRecur(vrecurr).to_ical().decode() == "FREQ=MONTHLY;BYMONTHDAY=-1" assert len(vrecurr.keys()) == 2
def test_ever_month_3rd_last_tu(self): """Repeat every month on the 3rd last Tuesday.""" vrecurr = utils.build_rrule(freq="MONTHLY", byday="-3TU") assert vrecurr["FREQ"] == "MONTHLY" assert vrecurr["BYDAY"] == "-3TU" vRecur(vrecurr).to_ical().decode() == "FREQ=MONTHLY;BYDAY=-3TU" assert len(vrecurr.keys()) == 2
def test_weekly_tue(self): """Repeat every week on Tuesday.""" vrecurr = utils.build_rrule(freq='WEEKLY', byday='TU') assert vrecurr['FREQ'] == 'WEEKLY' assert vrecurr['BYDAY'] == 'TU' vRecur(vrecurr).to_ical().decode() == 'FREQ=WEEKLY;BYDAY=TU' assert len(vrecurr.keys()) == 2
def test_every_weekday(self): """Repeat every weekday.""" vrecurr = utils.build_rrule(freq='WEEKLY', byday=['MO', 'TU', 'WE', 'TH', 'FR']) assert vrecurr['FREQ'] == 'WEEKLY' assert vrecurr['BYDAY'] == ['MO', 'TU', 'WE', 'TH', 'FR'] vRecur(vrecurr).to_ical().decode() == 'FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR' assert len(vrecurr.keys()) == 2
def test_weekly_tue(self): """Repeat every week on Tuesday.""" vrecurr = utils.build_rrule(freq="WEEKLY", byday="TU") assert vrecurr["FREQ"] == "WEEKLY" assert vrecurr["BYDAY"] == "TU" vRecur(vrecurr).to_ical().decode() == "FREQ=WEEKLY;BYDAY=TU" assert len(vrecurr.keys()) == 2
def test_ever_4_hours(self): """Repeat every 4 hours.""" vrecurr = utils.build_rrule(interval=4, freq="HOURLY") assert vrecurr["FREQ"] == "HOURLY" assert vrecurr["INTERVAL"] == 4 vRecur(vrecurr).to_ical().decode() == "FREQ=HOURLY;INTERVAL=4" assert len(vrecurr.keys()) == 2
def test_weekly_mo_wed(self): """Repeat every week on Monday, Wednesday.""" vrecurr = utils.build_rrule(freq="WEEKLY", byday=["MO", "WE"]) assert vrecurr["FREQ"] == "WEEKLY" assert vrecurr["BYDAY"] == ["MO", "WE"] vRecur(vrecurr).to_ical().decode() == "FREQ=WEEKLY;BYDAY=MO,WE" assert len(vrecurr.keys()) == 2
def test_daily_byhour_once(self): """Repeat every day at 10.""" vrecurr = utils.build_rrule(freq="DAILY", byhour=10) assert vrecurr["FREQ"] == "DAILY" assert vrecurr["BYHOUR"] == 10 vRecur(vrecurr).to_ical().decode() == "FREQ=DAILY;BYHOUR=10" assert len(vrecurr.keys()) == 2
def test_every_2_weeks(self): """Repeat every 2 weeks.""" vrecurr = utils.build_rrule(interval=2, freq='WEEKLY') assert vrecurr['FREQ'] == 'WEEKLY' assert vrecurr['INTERVAL'] == 2 vRecur(vrecurr).to_ical().decode() == 'FREQ=WEEKLY;INTERVAL=2' assert len(vrecurr.keys()) == 2
def test_every_6_months(self): """Repeat very 6 months.""" vrecurr = utils.build_rrule(interval=6, freq="MONTHLY") assert vrecurr["FREQ"] == "MONTHLY" assert vrecurr["INTERVAL"] == 6 vRecur(vrecurr).to_ical().decode() == "FREQ=MONTHLY;INTERVAL=6" assert len(vrecurr.keys()) == 2
def test_every_week_20_times(self): """Repeat every week for 20 times.""" vrecurr = utils.build_rrule(freq='WEEKLY', count=20) assert vrecurr['FREQ'] == 'WEEKLY' assert vrecurr['COUNT'] == 20 vRecur(vrecurr).to_ical().decode() == 'FREQ=WEEKLY;COUNT=20' assert len(vrecurr.keys()) == 2
def test_ever_month_last_day(self): """Repeat the last day of each month.""" vrecurr = utils.build_rrule(freq='MONTHLY', bymonthday=-1) assert vrecurr['FREQ'] == 'MONTHLY' assert vrecurr['BYMONTHDAY'] == -1 vRecur(vrecurr).to_ical().decode() == 'FREQ=MONTHLY;BYMONTHDAY=-1' assert len(vrecurr.keys()) == 2
def test_ever_month_last_mo(self): """Repeat every month on the last Monday.""" vrecurr = utils.build_rrule(freq='MONTHLY', byday='-1MO') assert vrecurr['FREQ'] == 'MONTHLY' assert vrecurr['BYDAY'] == '-1MO' vRecur(vrecurr).to_ical().decode() == 'FREQ=MONTHLY;BYDAY=-1MO' assert len(vrecurr.keys()) == 2
def test_weekly_mo_wed(self): """Repeat every week on Monday, Wednesday.""" vrecurr = utils.build_rrule(freq='WEEKLY', byday=['MO', 'WE']) assert vrecurr['FREQ'] == 'WEEKLY' assert vrecurr['BYDAY'] == ['MO', 'WE'] vRecur(vrecurr).to_ical().decode() == 'FREQ=WEEKLY;BYDAY=MO,WE' assert len(vrecurr.keys()) == 2
def test_ever_month_3rd_last_tu(self): """Repeat every month on the 3rd last Tuesday.""" vrecurr = utils.build_rrule(freq='MONTHLY', byday='-3TU') assert vrecurr['FREQ'] == 'MONTHLY' assert vrecurr['BYDAY'] == '-3TU' vRecur(vrecurr).to_ical().decode() == 'FREQ=MONTHLY;BYDAY=-3TU' assert len(vrecurr.keys()) == 2
def test_every_month_on_the_4th_last(self): """Repeat every month on the 4th last.""" vrecurr = utils.build_rrule(freq='MONTHLY', bymonthday=-4) assert vrecurr['FREQ'] == 'MONTHLY' assert vrecurr['BYMONTHDAY'] == -4 vRecur(vrecurr).to_ical().decode() == 'FREQ=MONTHLY;BYMONTHDAY=-4' assert len(vrecurr.keys()) == 2
def test_every_6_months(self): """Repeat very 6 months.""" vrecurr = utils.build_rrule(interval=6, freq='MONTHLY') assert vrecurr['FREQ'] == 'MONTHLY' assert vrecurr['INTERVAL'] == 6 vRecur(vrecurr).to_ical().decode() == 'FREQ=MONTHLY;INTERVAL=6' assert len(vrecurr.keys()) == 2
def test_every_2nd_15th_of_month(self): """Repeat monthly on the 2nd and 15th of the month.""" vrecurr = utils.build_rrule(freq='MONTHLY', bymonthday=[4, 15]) assert vrecurr['FREQ'] == 'MONTHLY' assert vrecurr['BYMONTHDAY'] == [4, 15] vRecur(vrecurr).to_ical().decode() == 'FREQ=MONTHLY;BYMONTHDAY=4,15' assert len(vrecurr.keys()) == 2
def test_daily_byhour(self): """Repeat every day at 10, 12 and 17.""" vrecurr = utils.build_rrule(freq='DAILY', byhour=[10, 12, 17]) assert vrecurr['FREQ'] == 'DAILY' assert vrecurr['BYHOUR'] == [10, 12, 17] vRecur(vrecurr).to_ical().decode() == 'FREQ=DAILY;BYHOUR=10,12,17' assert len(vrecurr.keys()) == 2
def test_every_6_months(self): """Repeat very 6 months.""" vrecurr = utils.build_rrule(interval=6, freq='MONTHLY') assert vrecurr['FREQ'] == 'MONTHLY' assert vrecurr['INTERVAL'] == 6 vRecur(vrecurr).to_ical().decode() == 'FREQ=MONTHLY;INTERVAL=6' assert len(vrecurr.keys()) == 2
def test_daily_byhour(self): """Repeat every day at 10, 12 and 17.""" vrecurr = utils.build_rrule(freq='DAILY', byhour=[10, 12, 17]) assert vrecurr['FREQ'] == 'DAILY' assert vrecurr['BYHOUR'] == [10, 12, 17] vRecur(vrecurr).to_ical().decode() == 'FREQ=DAILY;BYHOUR=10,12,17' assert len(vrecurr.keys()) == 2
def test_ever_month_3rd_last_tu(self): """Repeat every month on the 3rd last Tuesday.""" vrecurr = utils.build_rrule(freq='MONTHLY', byday='-3TU') assert vrecurr['FREQ'] == 'MONTHLY' assert vrecurr['BYDAY'] == '-3TU' vRecur(vrecurr).to_ical().decode() == 'FREQ=MONTHLY;BYDAY=-3TU' assert len(vrecurr.keys()) == 2
def test_weekly_tue(self): """Repeat every week on Tuesday.""" vrecurr = utils.build_rrule(freq='WEEKLY', byday='TU') assert vrecurr['FREQ'] == 'WEEKLY' assert vrecurr['BYDAY'] == 'TU' vRecur(vrecurr).to_ical().decode() == 'FREQ=WEEKLY;BYDAY=TU' assert len(vrecurr.keys()) == 2
def test_ever_4_hours(self): """Repeat every 4 hours.""" vrecurr = utils.build_rrule(interval=4, freq='HOURLY') assert vrecurr['FREQ'] == 'HOURLY' assert vrecurr['INTERVAL'] == 4 vRecur(vrecurr).to_ical().decode() == 'FREQ=HOURLY;INTERVAL=4' assert len(vrecurr.keys()) == 2
def test_daily_byhour(self): """Repeat every day at 10, 12 and 17.""" vrecurr = utils.build_rrule(freq="DAILY", byhour=[10, 12, 17]) assert vrecurr["FREQ"] == "DAILY" assert vrecurr["BYHOUR"] == [10, 12, 17] vRecur(vrecurr).to_ical().decode() == "FREQ=DAILY;BYHOUR=10,12,17" assert len(vrecurr.keys()) == 2
def test_every_2_weeks(self): """Repeat every 2 weeks.""" vrecurr = utils.build_rrule(interval=2, freq='WEEKLY') assert vrecurr['FREQ'] == 'WEEKLY' assert vrecurr['INTERVAL'] == 2 vRecur(vrecurr).to_ical().decode() == 'FREQ=WEEKLY;INTERVAL=2' assert len(vrecurr.keys()) == 2
def test_weekly_mo_wed(self): """Repeat every week on Monday, Wednesday.""" vrecurr = utils.build_rrule(freq='WEEKLY', byday=['MO', 'WE']) assert vrecurr['FREQ'] == 'WEEKLY' assert vrecurr['BYDAY'] == ['MO', 'WE'] vRecur(vrecurr).to_ical().decode() == 'FREQ=WEEKLY;BYDAY=MO,WE' assert len(vrecurr.keys()) == 2
def test_daily_byhour_once(self): """Repeat every day at 10.""" vrecurr = utils.build_rrule(freq='DAILY', byhour=10) assert vrecurr['FREQ'] == 'DAILY' assert vrecurr['BYHOUR'] == 10 vRecur(vrecurr).to_ical().decode() == 'FREQ=DAILY;BYHOUR=10' assert len(vrecurr.keys()) == 2
def test_every_month_on_the_4th(self): """Repeat every month on the 4th.""" vrecurr = utils.build_rrule(freq="MONTHLY", bymonthday=4) assert vrecurr["FREQ"] == "MONTHLY" assert vrecurr["BYMONTHDAY"] == 4 vRecur(vrecurr).to_ical().decode() == "FREQ=MONTHLY;BYMONTHDAY=4" assert len(vrecurr.keys()) == 2
def test_ever_4_hours(self): """Repeat every 4 hours.""" vrecurr = utils.build_rrule(interval=4, freq='HOURLY') assert vrecurr['FREQ'] == 'HOURLY' assert vrecurr['INTERVAL'] == 4 vRecur(vrecurr).to_ical().decode() == 'FREQ=HOURLY;INTERVAL=4' assert len(vrecurr.keys()) == 2
def test_daily_byhour_once(self): """Repeat every day at 10.""" vrecurr = utils.build_rrule(freq='DAILY', byhour=10) assert vrecurr['FREQ'] == 'DAILY' assert vrecurr['BYHOUR'] == 10 vRecur(vrecurr).to_ical().decode() == 'FREQ=DAILY;BYHOUR=10' assert len(vrecurr.keys()) == 2
def test_ever_month_last_mo(self): """Repeat every month on the last Monday.""" vrecurr = utils.build_rrule(freq='MONTHLY', byday='-1MO') assert vrecurr['FREQ'] == 'MONTHLY' assert vrecurr['BYDAY'] == '-1MO' vRecur(vrecurr).to_ical().decode() == 'FREQ=MONTHLY;BYDAY=-1MO' assert len(vrecurr.keys()) == 2
def test_every_2_weeks(self): """Repeat every 2 weeks.""" vrecurr = utils.build_rrule(interval=2, freq="WEEKLY") assert vrecurr["FREQ"] == "WEEKLY" assert vrecurr["INTERVAL"] == 2 vRecur(vrecurr).to_ical().decode() == "FREQ=WEEKLY;INTERVAL=2" assert len(vrecurr.keys()) == 2
def test_every_month_on_the_4th_last(self): """Repeat every month on the 4th last.""" vrecurr = utils.build_rrule(freq='MONTHLY', bymonthday=-4) assert vrecurr['FREQ'] == 'MONTHLY' assert vrecurr['BYMONTHDAY'] == -4 vRecur(vrecurr).to_ical().decode() == 'FREQ=MONTHLY;BYMONTHDAY=-4' assert len(vrecurr.keys()) == 2
def test_every_2nd_15th_of_month(self): """Repeat monthly on the 2nd and 15th of the month.""" vrecurr = utils.build_rrule(freq='MONTHLY', bymonthday=[4, 15]) assert vrecurr['FREQ'] == 'MONTHLY' assert vrecurr['BYMONTHDAY'] == [4, 15] vRecur(vrecurr).to_ical().decode() == 'FREQ=MONTHLY;BYMONTHDAY=4,15' assert len(vrecurr.keys()) == 2
def test_ever_month_last_day(self): """Repeat the last day of each month.""" vrecurr = utils.build_rrule(freq='MONTHLY', bymonthday=-1) assert vrecurr['FREQ'] == 'MONTHLY' assert vrecurr['BYMONTHDAY'] == -1 vRecur(vrecurr).to_ical().decode() == 'FREQ=MONTHLY;BYMONTHDAY=-1' assert len(vrecurr.keys()) == 2
def test_every_week_20_times(self): """Repeat every week for 20 times.""" vrecurr = utils.build_rrule(freq='WEEKLY', count=20) assert vrecurr['FREQ'] == 'WEEKLY' assert vrecurr['COUNT'] == 20 vRecur(vrecurr).to_ical().decode() == 'FREQ=WEEKLY;COUNT=20' assert len(vrecurr.keys()) == 2
def test_every_fr_13th(self): """Repeat every Friday the 13th.""" vrecurr = utils.build_rrule(freq='YEARLY', bymonthday=13, byday='FR') assert vrecurr['FREQ'] == 'YEARLY' assert vrecurr['BYMONTHDAY'] == 13 assert vrecurr['BYDAY'] == 'FR' vRecur(vrecurr).to_ical().decode() == 'FREQ=YEARLY;BYDAY=FR;BYMONTHDAY=13' assert len(vrecurr.keys()) == 3
def test_every_day_in_jan(self): """Repeat every day in January""" vrecurr = utils.build_rrule(freq='YEARLY', bymonth=1, byday=['MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU']) assert vrecurr['FREQ'] == 'YEARLY' assert vrecurr['BYMONTH'] == 1 assert vrecurr['BYDAY'] == ['MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU'] vRecur(vrecurr).to_ical().decode() == 'FREQ=YEARLY;BYDAY=MO,TU,WE,TH,FR,SA,SU;BYMONTH=1' assert len(vrecurr.keys()) == 3
def test_every_month_last_working_day(self): """Repeat the last working day of each month.""" vrecurr = utils.build_rrule(freq='MONTHLY', byday=['MO', 'TU', 'WE', 'TH', 'FR'], bysetpos=-1) assert vrecurr['FREQ'] == 'MONTHLY' assert vrecurr['BYDAY'] == ['MO', 'TU', 'WE', 'TH', 'FR'] assert vrecurr['BYSETPOS'] == -1 vRecur(vrecurr).to_ical().decode() == 'FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1' assert len(vrecurr.keys()) == 3
def test_every_week_until_jan_2007(self): """Repeat every week until January 1, 2007.""" utc = pytz.UTC jan2007 = datetime.datetime(2007, 1, 1, 0, 0, tzinfo=utc) vrecurr = utils.build_rrule(freq='WEEKLY', until=jan2007) assert vrecurr['FREQ'] == 'WEEKLY' assert vrecurr['UNTIL'] == jan2007 vRecur(vrecurr).to_ical().decode() == 'FREQ=WEEKLY;UNTIL=20070101T000000Z' assert len(vrecurr.keys()) == 2
def test_every_weekday(self): """Repeat every weekday.""" vrecurr = utils.build_rrule(freq='WEEKLY', byday=['MO', 'TU', 'WE', 'TH', 'FR']) assert vrecurr['FREQ'] == 'WEEKLY' assert vrecurr['BYDAY'] == ['MO', 'TU', 'WE', 'TH', 'FR'] vRecur( vrecurr).to_ical().decode() == 'FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR' assert len(vrecurr.keys()) == 2
def test_every_fr_13th(self): """Repeat every Friday the 13th.""" vrecurr = utils.build_rrule(freq='YEARLY', bymonthday=13, byday='FR') assert vrecurr['FREQ'] == 'YEARLY' assert vrecurr['BYMONTHDAY'] == 13 assert vrecurr['BYDAY'] == 'FR' vRecur( vrecurr).to_ical().decode() == 'FREQ=YEARLY;BYDAY=FR;BYMONTHDAY=13' assert len(vrecurr.keys()) == 3
def test_every_fr_13th(self): """Repeat every Friday the 13th.""" vrecurr = utils.build_rrule(freq="YEARLY", bymonthday=13, byday="FR") assert vrecurr["FREQ"] == "YEARLY" assert vrecurr["BYMONTHDAY"] == 13 assert vrecurr["BYDAY"] == "FR" vRecur( vrecurr).to_ical().decode() == "FREQ=YEARLY;BYDAY=FR;BYMONTHDAY=13" assert len(vrecurr.keys()) == 3
def test_every_weekday(self): """Repeat every weekday.""" vrecurr = utils.build_rrule(freq="WEEKLY", byday=["MO", "TU", "WE", "TH", "FR"]) assert vrecurr["FREQ"] == "WEEKLY" assert vrecurr["BYDAY"] == ["MO", "TU", "WE", "TH", "FR"] vRecur( vrecurr).to_ical().decode() == "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR" assert len(vrecurr.keys()) == 2
def test_every_week_until_jan_2007(self): """Repeat every week until January 1, 2007.""" utc = pytz.UTC jan2007 = datetime.datetime(2007, 1, 1, 0, 0, tzinfo=utc) vrecurr = utils.build_rrule(freq='WEEKLY', until=jan2007) assert vrecurr['FREQ'] == 'WEEKLY' assert vrecurr['UNTIL'] == jan2007 vRecur( vrecurr).to_ical().decode() == 'FREQ=WEEKLY;UNTIL=20070101T000000Z' assert len(vrecurr.keys()) == 2
def test_every_month(self): """Repeat every month.""" vrecurr = utils.build_rrule(freq='MONTHLY') assert vrecurr['FREQ'] == 'MONTHLY' vRecur(vrecurr).to_ical().decode() == 'FREQ=MONTHLY' assert len(vrecurr.keys()) == 1
def test_every_day(self): """Repeat every day.""" vrecurr = vRecur(utils.build_rrule(freq='DAILY')) assert vrecurr['FREQ'] == 'DAILY' assert vrecurr.to_ical().decode() == 'FREQ=DAILY' assert len(vrecurr.keys()) == 1
def test_ever_hour(self): """Repeat every hour.""" vrecurr = utils.build_rrule(freq='HOURLY') assert vrecurr['FREQ'] == 'HOURLY' vRecur(vrecurr).to_ical().decode() == 'FREQ=HOURLY' assert len(vrecurr.keys()) == 1
def test_every_week(self): """Repeat every week.""" vrecurr = utils.build_rrule(freq='WEEKLY') assert vrecurr['FREQ'] == 'WEEKLY' vRecur(vrecurr).to_ical().decode() == 'FREQ=WEEKLY' assert len(vrecurr.keys()) == 1