本文整理汇总了Python中pycalendar.icalendar.calendar.Calendar.duplicate方法的典型用法代码示例。如果您正苦于以下问题:Python Calendar.duplicate方法的具体用法?Python Calendar.duplicate怎么用?Python Calendar.duplicate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pycalendar.icalendar.calendar.Calendar
的用法示例。
在下文中一共展示了Calendar.duplicate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _doDuplicateRoundtrip
# 需要导入模块: from pycalendar.icalendar.calendar import Calendar [as 别名]
# 或者: from pycalendar.icalendar.calendar.Calendar import duplicate [as 别名]
def _doDuplicateRoundtrip(caldata):
cal = Calendar()
cal.parse(StringIO.StringIO(caldata))
cal = cal.duplicate()
s = StringIO.StringIO()
cal.generate(s)
self.assertEqual(caldata, s.getvalue())
示例2: testDuplicateWithRecurrenceChange
# 需要导入模块: from pycalendar.icalendar.calendar import Calendar [as 别名]
# 或者: from pycalendar.icalendar.calendar.Calendar import duplicate [as 别名]
def testDuplicateWithRecurrenceChange(self):
data = (
"""BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:-//mulberrymail.com//Mulberry v4.0//EN
BEGIN:VEVENT
UID:C3184A66-1ED0-11D9-A5E0-000A958A3252
DTSTART;VALUE=DATE:20020101
DTEND;VALUE=DATE:20020102
DTSTAMP:20020101T000000Z
RRULE:FREQ=YEARLY
SUMMARY:New Year's Day
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n"),
"""BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:-//mulberrymail.com//Mulberry v4.0//EN
BEGIN:VEVENT
UID:C3184A66-1ED0-11D9-A5E0-000A958A3252
DTSTART;VALUE=DATE:20020101
DTEND;VALUE=DATE:20020102
DTSTAMP:20020101T000000Z
RRULE:FREQ=YEARLY;COUNT=400
SUMMARY:New Year's Day
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n"),
)
cal1 = Calendar()
cal1.parse(StringIO.StringIO(data[0]))
cal2 = cal1.duplicate()
vevent = cal2.getComponents()[0]
rrules = vevent.getRecurrenceSet()
for rrule in rrules.getRules():
rrule.setUseCount(True)
rrule.setCount(400)
rrules.changed()
self.assertEqual(data[0], str(cal1))
self.assertEqual(data[1], str(cal2))