Skip to content

Commit

Permalink
Merge pull request #9 from PabloCastellano/master
Browse files Browse the repository at this point in the history
Parse event's description attribute
  • Loading branch information
Thomas Irgang authored Feb 8, 2018
2 parents f04272f + c565f79 commit e6f9812
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion icalevents/icalparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def next_month_at(dt, count=1):

def create_event(component):
"""
Create an event form its iCal representation.
Create an event from its iCal representation.
:param component: iCal component
:return: event
Expand All @@ -157,6 +157,7 @@ def create_event(component):
event.start = event_start
event.end = event_end
event.summary = str(component.get('summary'))
event.description = str(component.get('description'))
event.all_day = type(component.get('dtstart').dt) is datetime.date

return event
Expand Down
11 changes: 11 additions & 0 deletions test/test_icalevents.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ def test_events(self):

self.assertEqual(len(evs), 2, "two events are found")

def test_event_attributes(self):
ical = "test/test_data/basic.ics"
start = date(2017, 7, 12)
end = date(2017, 7, 13)

ev = icalevents.events(url=None, file=ical, start=start, end=end)[0]

self.assertEqual(ev.summary, "graue Restmülltonne")
self.assertEqual(ev.description, "graue Restmülltonne nicht vergessen!")
self.assertFalse(ev.all_day)

def test_events_async_url(self):
url = "https://raw.githubusercontent.com/irgangla/icalevents/master/test/test_data/basic.ics"
start = date(2017, 5, 18)
Expand Down

0 comments on commit e6f9812

Please sign in to comment.