OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # coding=utf8 | 2 # coding=utf8 |
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """Unit tests for fix_encoding.py.""" | 7 """Unit tests for fix_encoding.py.""" |
8 | 8 |
9 import os | 9 import os |
10 import sys | 10 import sys |
11 import unittest | 11 import unittest |
12 | 12 |
13 ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | 13 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
14 sys.path.insert(0, ROOT_DIR) | |
15 | 14 |
16 import fix_encoding | 15 import fix_encoding |
17 | 16 |
18 | 17 |
19 class FixEncodingTest(unittest.TestCase): | 18 class FixEncodingTest(unittest.TestCase): |
20 # Nice mix of latin, hebrew, arabic and chinese. Doesn't mean anything. | 19 # Nice mix of latin, hebrew, arabic and chinese. Doesn't mean anything. |
21 text = u'Héllô 偉大 سيد' | 20 text = u'Héllô 偉大 سيد' |
22 | 21 |
23 def test_code_page(self): | 22 def test_code_page(self): |
24 # Make sure printing garbage won't throw. | 23 # Make sure printing garbage won't throw. |
(...skipping 27 matching lines...) Expand all Loading... |
52 self.assertEquals(sys.stderr.encoding, sys.getdefaultencoding()) | 51 self.assertEquals(sys.stderr.encoding, sys.getdefaultencoding()) |
53 | 52 |
54 def test_multiple_calls(self): | 53 def test_multiple_calls(self): |
55 # Shouldn't do anything. | 54 # Shouldn't do anything. |
56 self.assertEquals(False, fix_encoding.fix_encoding()) | 55 self.assertEquals(False, fix_encoding.fix_encoding()) |
57 | 56 |
58 | 57 |
59 if __name__ == '__main__': | 58 if __name__ == '__main__': |
60 assert fix_encoding.fix_encoding() | 59 assert fix_encoding.fix_encoding() |
61 unittest.main() | 60 unittest.main() |
OLD | NEW |