Commit 723f6254 authored by Bram Schoenmakers's avatar Bram Schoenmakers

icalendar's to_ical returns bytes, convert back to string.

Also fix the ical test case that reads the test data incorrectly.
Windows newlines were not properly decoded, resulting in a mismatch
between the output of the icalendar package and the test data file.
parent 0599cd22
......@@ -14,6 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import codecs
import re
import unittest
......@@ -41,8 +42,8 @@ class IcalCommandTest(CommandTest):
self.assertTrue(self.todolist.is_dirty())
icaltext = ""
with open('test/data/ListCommandTest.ics', 'r') as ical:
icaltext = "".join(ical.readlines())
with codecs.open('test/data/ListCommandTest.ics', 'r', encoding='utf-8') as ical:
icaltext = ical.read()
self.assertEqual(replace_ical_tags(self.output), replace_ical_tags(icaltext))
self.assertEqual(self.errors, "")
......
......@@ -86,7 +86,7 @@ class IcalPrinter(Printer):
for todo in p_todos:
cal.add_component(self._convert_todo(todo))
result = cal.to_ical()
result = cal.to_ical().decode('utf-8')
return result
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment