コード例 #1
0
ファイル: calendar.py プロジェクト: glsonline/ics.py
 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
0
ファイル: calendar.py プロジェクト: C4ptainCrunch/ics.py
    def test_todos_setter(self):

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

        self.assertEqual(c.todos, [t])
コード例 #3
0
ファイル: calendar.py プロジェクト: glsonline/ics.py
 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
0
ファイル: calendar.py プロジェクト: glsonline/ics.py
    def test_events_setter(self):

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

        self.assertEqual(c.events, [e])
コード例 #5
0
    def test_clone(self):
        c0 = Calendar()
        e = Event()
        c0.events.add(e)
        c1 = c0.clone()

        self.assertEqual(c0.events, c1.events)
        self.assertEqual(c0, c1)
コード例 #6
0
ファイル: calendar.py プロジェクト: glsonline/ics.py
    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')
コード例 #7
0
ファイル: calendar.py プロジェクト: glsonline/ics.py
    def test_events_eventlist(self):

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

        self.assertEqual(c.events, [e])
コード例 #8
0
ファイル: calendar.py プロジェクト: glsonline/ics.py
    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)
コード例 #9
0
ファイル: calendar.py プロジェクト: glsonline/ics.py
    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>')
コード例 #10
0
ファイル: calendar.py プロジェクト: jammon/ics.py
    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')
コード例 #11
0
ファイル: calendar.py プロジェクト: C4ptainCrunch/ics.py
    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>')
コード例 #12
0
ファイル: calendar.py プロジェクト: glsonline/ics.py
    def test_events_set_string(self):

        c = Calendar(cal1)
        e = "42"
        with self.assertRaises(ValueError):
            c.events = e
コード例 #13
0
 def test_fixtures_time(self):
     with open(os.path.join(os.path.dirname(__file__),
                            "fixtures/time.ics")) as f:
         Calendar(f.read().replace("BEGIN:VCALENDAR",
                                   "BEGIN:VCALENDAR\nPRODID:Fixture"))
コード例 #14
0
ファイル: calendar.py プロジェクト: glsonline/ics.py
    def test_events_set_int(self):

        c = Calendar()

        with self.assertRaises(ValueError):
            c.events = 42
コード例 #15
0
 def test_all_day_duration(self):
     c = Calendar(cal17)
     e = c.events[0]
     self.assertTrue(e.all_day)
     self.assertEqual(e.duration, timedelta(days=3))
コード例 #16
0
 def test_fixtures_timezoned(self):
     with open(
             os.path.join(os.path.dirname(__file__),
                          "fixtures/timezoned.ics")) as f:
         Calendar(f.read())
コード例 #17
0
 def test_issue_90(self):
     Calendar(cal32)
コード例 #18
0
 def test_all_day_with_end(self):
     c = Calendar(cal17)
     e = c.events[0]
     self.assertTrue(e.all_day)
コード例 #19
0
ファイル: calendar.py プロジェクト: yizhouwu/ics.py
    def test_init_int(self):

        with self.assertRaises(TypeError):
            Calendar(42)
コード例 #20
0
ファイル: calendar.py プロジェクト: yizhouwu/ics.py
 def test_repr(self):
     c = Calendar()
     self.assertEqual(c.__urepr__(), repr(c))
コード例 #21
0
 def test_fixtures_utf_8_emoji(self):
     with open(
             os.path.join(os.path.dirname(__file__),
                          "fixtures/utf-8-emoji.ics")) as f:
         Calendar(f.read())
コード例 #22
0
ファイル: calendar.py プロジェクト: yizhouwu/ics.py
    def test_multiple_calendars(self):

        with self.assertRaises(TypeError):
            Calendar() + Calendar()
コード例 #23
0
ファイル: calendar.py プロジェクト: yizhouwu/ics.py
    def test_scale(self):

        c = Calendar(cal10)

        self.assertEqual(c.scale, u'georgian')
コード例 #24
0
ファイル: calendar.py プロジェクト: yizhouwu/ics.py
    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")
コード例 #25
0
ファイル: calendar.py プロジェクト: yizhouwu/ics.py
 def test_neq_creator(self):
     c0, c1 = Calendar(), Calendar(creator="test")
     self.assertNotEqual(c0, c1)
コード例 #26
0
ファイル: calendar.py プロジェクト: glsonline/ics.py
 def test_repr(self):
     c = Calendar()
     self.assertEqual(c.__urepr__(), repr(c))
コード例 #27
0
 def test_status_input(self):
     c = Calendar(cal16)
     e = next(iter(c.events))
     self.assertEqual(e.status, "CONFIRMED")
コード例 #28
0
 def test_fixtures_encoding(self):
     with open(
             os.path.join(os.path.dirname(__file__),
                          "fixtures/encoding.ics")) as f:
         Calendar(f.read())
コード例 #29
0
 def test_category_input(self):
     c = Calendar(cal16)
     e = next(iter(c.events))
     self.assertIn("Simple Category", e.categories)
     self.assertIn("My \"Quoted\" Category", e.categories)
     self.assertIn("Category, with comma", e.categories)
コード例 #30
0
 def test_url_input(self):
     c = Calendar(cal16)
     e = c.events[0]
     self.assertEqual(e.url,
                      "http://example.com/pub/calendars/jsmith/mytime.ics")
コード例 #31
0
 def test_all_day_with_end(self):
     c = Calendar(cal20)
     e = next(iter(c.events))
     self.assertTrue(e.all_day)
コード例 #32
0
 def test_not_all_day(self):
     c = Calendar(cal16)
     e = c.events[0]
     self.assertFalse(e.all_day)
コード例 #33
0
ファイル: event.py プロジェクト: jammon/ics.py
 def test_not_duration_and_end(self):
     c = Calendar(calendar_with_duration_and_end)
     with self.assertRaises(ValueError):
         c.validate()
コード例 #34
0
 def test_event_with_duration(self):
     c = Calendar(cal12)
     e = c.events[0]
     self.assertEqual(e._duration, timedelta(1, 3600))
     self.assertEqual(e.end - e.begin, timedelta(1, 3600))
コード例 #35
0
ファイル: calendar.py プロジェクト: jammon/ics.py
 def test_no_prodid(self):
     c = Calendar(calendar_without_prodid)
     with self.assertRaises(ValueError):
         c.validate()
コード例 #36
0
ファイル: calendar.py プロジェクト: glsonline/ics.py
    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")
コード例 #37
0
 def test_default_transparent_input(self):
     c = Calendar(cal18)
     e = next(iter(c.events))
     self.assertEqual(e.transparent, False)
コード例 #38
0
 def test_fixtures_recurrence(self):
     with open(
             os.path.join(os.path.dirname(__file__),
                          "fixtures/recurrence.ics")) as f:
         Calendar(f.read())
コード例 #39
0
 def test_event_with_duration(self):
     c = Calendar(cal12)
     e = next(iter(c.events))
     self.assertEqual(e._duration, td(1, 3600))
     self.assertEqual(e.end - e.begin, td(1, 3600))
コード例 #40
0
 def test_fixtures_multiple(self):
     with open(
             os.path.join(os.path.dirname(__file__),
                          "fixtures/multiple.ics")) as f:
         Calendar.parse_multiple(f.read())
コード例 #41
0
 def test_not_duration_and_end(self):
     with self.assertRaises(ValueError):
         Calendar(cal13)
コード例 #42
0
 def test_fixtures_groupscheduled(self):
     with open(
             os.path.join(os.path.dirname(__file__),
                          "fixtures/groupscheduled.ics")) as f:
         Calendar(f.read())
コード例 #43
0
    def test_issue_92(self):
        c = Calendar(cal32)
        e = list(c.events)[0]

        assert e.begin == arrow.get('2016-10-04')
        assert e.end == arrow.get('2016-10-05')
コード例 #44
0
ファイル: calendar.py プロジェクト: glsonline/ics.py
 def test_eventlist_is_same(self):
     c = Calendar()
     l = EventList()
     c.events = l
     self.assertIs(c.events, l)
コード例 #45
0
 def test_unescapte_texts(self):
     c = Calendar(cal15)
     e = c.events[1]
     self.assertEqual(e.name, "Some special ; chars")
     self.assertEqual(e.location, "In, every text field")
     self.assertEqual(e.description, "Yes, all of them;")
コード例 #46
0
 def test_not_all_day(self):
     c = Calendar(cal16)
     e = next(iter(c.events))
     self.assertFalse(e.all_day)
コード例 #47
0
 def test_fixtures_spaces(self):
     with open(
             os.path.join(os.path.dirname(__file__),
                          "fixtures/spaces.ics")) as f:
         Calendar(f.read())
コード例 #48
0
ファイル: component.py プロジェクト: I-GV/ics.py
 def test_bad_type(self):
     container = Container(name='VINVALID')
     with self.assertRaises(ValueError):
         Calendar._from_container(container)
コード例 #49
0
 def test_all_day_duration(self):
     c = Calendar(cal20)
     e = next(iter(c.events))
     self.assertTrue(e.all_day)
     self.assertEqual(e.duration, td(days=2))