git-cola v2.0.0
[git-cola.git] / test / core_test.py
blobeeb07790a22e22b4434c33d6fcd3d36766122e66
1 #!/usr/bin/env python
2 # -*- encoding: utf-8 -*-
3 from __future__ import unicode_literals
4 import unittest
6 import helper
8 from cola import core
11 class CoreColaUnicodeTestCase(unittest.TestCase):
12 """Tests the cola.core module's unicode handling
13 """
15 def test_core_decode(self):
16 """Test the core.decode function
17 """
18 filename = helper.fixture('unicode.txt')
19 expect = core.decode(core.encode('unicøde'))
20 actual = core.read(filename).strip()
21 self.assertEqual(expect, actual)
23 def test_core_encode(self):
24 """Test the core.encode function
25 """
26 filename = helper.fixture('unicode.txt')
27 expect = core.encode('unicøde')
28 actual = core.encode(core.read(filename).strip())
29 self.assertEqual(expect, actual)
31 def test_decode_None(self):
32 """Ensure that decode(None) returns None"""
33 expect = None
34 actual = core.decode(None)
35 self.assertEqual(expect, actual)
38 if __name__ == '__main__':
39 unittest.main()