本文整理汇总了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)
示例2: test_todos_setter
def test_todos_setter(self):
c = Calendar(cal1)
t = Todo()
c.todos = [t]
self.assertEqual(c.todos, [t])
示例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)
示例4: test_events_setter
def test_events_setter(self):
c = Calendar(cal1)
e = Event()
c.events = [e]
self.assertEqual(c.events, [e])
示例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])
示例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)
示例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')
示例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>')
示例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')
示例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>')
示例11: test_eventlist_is_same
def test_eventlist_is_same(self):
c = Calendar()
l = EventList()
c.events = l
self.assertIs(c.events, l)
示例12: test_repr
def test_repr(self):
c = Calendar()
self.assertEqual(c.__urepr__(), repr(c))
示例13: test_events_set_string
def test_events_set_string(self):
c = Calendar(cal1)
e = "42"
with self.assertRaises(ValueError):
c.events = e
示例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()
示例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")