Example #1
0
# The value is dependent on the libical version.
assert len(by_week_no) == 54 or len(by_week_no) == 56
by_month = recurrence.get_by_month()
# The value is dependent on the libical version.
assert len(by_month) == 13 or len(by_month) == 14
by_set_pos = recurrence.get_by_set_pos()
# The value is dependent on the libical version.
assert len(by_set_pos) == 367 or len(by_set_pos) == 386

recurrence.set_by_second(0, 1)
by_second = recurrence.get_by_second()
assert by_second[0] == 1

recurrence = ICalGLib.RecurrenceType.from_string(string)

assert (ICalGLib.recur_string_to_weekday("MO") ==
        ICalGLib.RecurrenceTypeWeekday.MONDAY_WEEKDAY)

start = 100000
result = ICalGLib.recur_expand_recurrence(string, start, 10)
secs_per_day = 24 * 60 * 60
for i in range(0, 9):
    assert (result[i] == start + i * secs_per_day)

string = "19970101T183248Z/19970102T071625Z"

period = ICalGLib.PeriodType.from_string(string)
start = period.get_start()

iter = ICalGLib.RecurIterator.new(recurrence, start)
timetype = iter.next()
Example #2
0
# The value is dependent on the libical version.
assert len(by_week_no) == 54 or len(by_week_no) == 56;
by_month = recurrence.get_by_month();
# The value is dependent on the libical version.
assert len(by_month) == 13 or len(by_month) == 14;
by_set_pos = recurrence.get_by_set_pos();
# The value is dependent on the libical version.
assert len(by_set_pos) == 367 or len(by_set_pos) == 386;

recurrence.set_by_second(0, 1);
by_second = recurrence.get_by_second();
assert by_second[0] == 1;

recurrence = ICalGLib.RecurrenceType.from_string(string);

assert(ICalGLib.recur_string_to_weekday("MO") == ICalGLib.RecurrenceTypeWeekday.MONDAY_WEEKDAY);

start = 100000;
result = ICalGLib.recur_expand_recurrence(string, start, 10);
secs_per_day = 24*60*60;
for i in range(0, 9):
    assert(result[i] == start + i*secs_per_day);

string = "19970101T183248Z/19970102T071625Z";

period = ICalGLib.PeriodType.from_string(string);
start = period.get_start();

iter = ICalGLib.RecurIterator.new(recurrence, start);
timetype = iter.next();
day = timetype.get_day();
Example #3
0
recurrence.set_by_set_pos_array(array)
assert recurrence.get_by_set_pos(0) == 900
assert recurrence.get_by_set_pos(1) == 901
assert recurrence.get_by_set_pos(2) == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
array = recurrence.get_by_set_pos_array()
assert array[0] == 900
assert array[1] == 901
assert array[2] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX

recurrence.set_by_second(0, 13)
by_second = recurrence.get_by_second_array()
assert by_second[0] == 13

recurrence = ICalGLib.Recurrence.from_string(string)

assert(ICalGLib.recur_string_to_weekday("MO") == ICalGLib.RecurrenceWeekday.MONDAY_WEEKDAY)

start = 100000
result = ICalGLib.recur_expand_recurrence(string, start, 10)
secs_per_day = 24*60*60
for i in range(0, 9):
    assert(result[i] == start + i*secs_per_day)

string = "19970101T183248Z/19970102T071625Z"

period = ICalGLib.Period.from_string(string)
start = period.get_start()

iter = ICalGLib.RecurIterator.new(recurrence, start)
timetype = iter.next()
day = timetype.get_day()