Commit 14ecbac7 authored by Jacek Sowiński's avatar Jacek Sowiński

Test printing ics (ical) output with unicode chars.

parent 4a7e8aed
......@@ -21,7 +21,7 @@ import unittest
from topydo.lib.Config import config
from topydo.commands.IcalCommand import IcalCommand
from test.CommandTest import CommandTest
from test.CommandTest import CommandTest, utf8
from test.TestFacilities import load_file_to_todolist
IS_PYTHON_32 = (sys.version_info.major, sys.version_info.minor) == (3, 2)
......@@ -80,5 +80,31 @@ class IcalCommandTest(CommandTest):
self.assertEqual(self.output, "")
self.assertEqual(self.errors, "icalendar is not supported in this Python version.\n")
class IcalCommandUnicodeTest(CommandTest):
def setUp(self):
super(IcalCommandUnicodeTest, self).setUp()
self.todolist = load_file_to_todolist("test/data/ListCommandUnicodeTest.txt")
@unittest.skipIf(IS_PYTHON_32, "icalendar is not supported for Python 3.2")
def test_ical_unicode(self):
def replace_ical_tags(p_text):
# replace identifiers with dots, since they're random.
result = re.sub(r'\bical:....\b', 'ical:....', p_text)
result = re.sub(r'\bUID:....\b', 'UID:....', result)
return result
command = IcalCommand([""], self.todolist, self.out, self.error)
command.execute()
# self.assertTrue(self.todolist.is_dirty())
icaltext = ""
with codecs.open('test/data/ListCommandUnicodeTest.ics', 'r', encoding='utf-8') as ical:
icaltext = ical.read()
self.assertEqual(replace_ical_tags(self.output), utf8(replace_ical_tags(icaltext)))
self.assertEqual(self.errors, "")
if __name__ == '__main__':
unittest.main()
This diff was suppressed by a .gitattributes entry.
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