当前位置: 首页>>代码示例>>Python>>正文


Python icalendar.Calendar类代码示例

本文整理汇总了Python中ics.icalendar.Calendar的典型用法代码示例。如果您正苦于以下问题:Python Calendar类的具体用法?Python Calendar怎么用?Python Calendar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Calendar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_list_to_eventlist

 def test_list_to_eventlist(self):
     c = Calendar()
     l = [Event(), Event(), Event(name='plop')]
     c.events = l
     self.assertIsNot(c.events, l)
     self.assertIsInstance(c.events, EventList)
     self.assertSequenceEqual(c.events, l)
开发者ID:glsonline,项目名称:ics.py,代码行数:7,代码来源:calendar.py

示例2: test_todos_setter

    def test_todos_setter(self):

        c = Calendar(cal1)
        t = Todo()
        c.todos = [t]

        self.assertEqual(c.todos, [t])
开发者ID:C4ptainCrunch,项目名称:ics.py,代码行数:7,代码来源:calendar.py

示例3: test_empty_list_to_eventlist

 def test_empty_list_to_eventlist(self):
     c = Calendar()
     l = []
     c.events = l
     self.assertIsNot(c.events, l)
     self.assertIsInstance(c.events, EventList)
     self.assertSequenceEqual(c.events, l)
开发者ID:glsonline,项目名称:ics.py,代码行数:7,代码来源:calendar.py

示例4: test_events_setter

    def test_events_setter(self):

        c = Calendar(cal1)
        e = Event()
        c.events = [e]

        self.assertEqual(c.events, [e])
开发者ID:glsonline,项目名称:ics.py,代码行数:7,代码来源:calendar.py

示例5: test_events_eventlist

    def test_events_eventlist(self):

        c = Calendar()
        l = EventList()
        e = Event()
        l.append(e)
        c.events = l

        self.assertEqual(c.events, [e])
开发者ID:glsonline,项目名称:ics.py,代码行数:9,代码来源:calendar.py

示例6: test_clone

    def test_clone(self):
        c0 = Calendar()
        e = Event()
        c0.events.append(e)
        c1 = c0.clone()

        self.assertTrue(len(c0.events) == len(c1.events))
        self.assertEqual(c0.events[0], c1.events[0])
        self.assertEqual(c0, c1)
开发者ID:glsonline,项目名称:ics.py,代码行数:9,代码来源:calendar.py

示例7: test_creator

    def test_creator(self):

        c0 = Calendar()
        c1 = Calendar()
        c0.creator = u'42'
        with self.assertRaises(ValueError):
            c1.creator = 42

        self.assertEqual(c0.creator, u'42')
开发者ID:glsonline,项目名称:ics.py,代码行数:9,代码来源:calendar.py

示例8: test_urepr

    def test_urepr(self):
        # TODO : more cases
        c = Calendar()
        self.assertEqual(c.__urepr__(), '<Calendar with 0 event>')

        c.events.append(Event())
        self.assertEqual(c.__urepr__(), '<Calendar with 1 event>')

        c.events.append(Event())
        self.assertEqual(c.__urepr__(), '<Calendar with 2 events>')
开发者ID:glsonline,项目名称:ics.py,代码行数:10,代码来源:calendar.py

示例9: test_creator

    def test_creator(self):

        c0 = Calendar()
        c1 = Calendar()
        c0.creator = u'42'
        # TextProperties are cast to a string type
        c1.creator = 42

        self.assertEqual(c0.creator, u'42')
        self.assertEqual(c1.creator, u'42')
开发者ID:jammon,项目名称:ics.py,代码行数:10,代码来源:calendar.py

示例10: test_repr

    def test_repr(self):
        # TODO : more cases
        c = Calendar()
        self.assertEqual(c.__repr__(), '<Calendar with 0 event and 0 todo>')

        c.events.add(Event())
        c.todos.add(Todo())
        self.assertEqual(c.__repr__(), '<Calendar with 1 event and 1 todo>')

        c.events.add(Event())
        c.todos.add(Todo())
        self.assertEqual(c.__repr__(), '<Calendar with 2 events and 2 todos>')
开发者ID:C4ptainCrunch,项目名称:ics.py,代码行数:12,代码来源:calendar.py

示例11: test_eventlist_is_same

 def test_eventlist_is_same(self):
     c = Calendar()
     l = EventList()
     c.events = l
     self.assertIs(c.events, l)
开发者ID:glsonline,项目名称:ics.py,代码行数:5,代码来源:calendar.py

示例12: test_repr

 def test_repr(self):
     c = Calendar()
     self.assertEqual(c.__urepr__(), repr(c))
开发者ID:glsonline,项目名称:ics.py,代码行数:3,代码来源:calendar.py

示例13: test_events_set_string

    def test_events_set_string(self):

        c = Calendar(cal1)
        e = "42"
        with self.assertRaises(ValueError):
            c.events = e
开发者ID:glsonline,项目名称:ics.py,代码行数:6,代码来源:calendar.py

示例14: test_not_duration_and_end

 def test_not_duration_and_end(self):
     c = Calendar(calendar_with_duration_and_end)
     with self.assertRaises(ValueError):
         c.validate()
开发者ID:jammon,项目名称:ics.py,代码行数:4,代码来源:event.py

示例15: test_existing_creator

    def test_existing_creator(self):
        c = Calendar(cal1)
        self.assertEqual(c.creator, u'-//Apple Inc.//Mac OS X 10.9//EN')

        c.creator = u"apple_is_a_fruit"
        self.assertEqual(c.creator, u"apple_is_a_fruit")
开发者ID:glsonline,项目名称:ics.py,代码行数:6,代码来源:calendar.py


注:本文中的ics.icalendar.Calendar类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。