Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(659)

Side by Side Diff: grit/util_unittest.py

Issue 9924009: Add c_format as a format option. (Closed) Base URL: https://grit-i18n.googlecode.com/svn/trunk
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « grit/util.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 '''Unit test that checks some of util functions. 6 '''Unit test that checks some of util functions.
7 ''' 7 '''
8 8
9 import os 9 import os
10 import sys 10 import sys
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 self.failUnless(util.CanonicalLanguage('pt-br') == 'pt-BR') 48 self.failUnless(util.CanonicalLanguage('pt-br') == 'pt-BR')
49 self.failUnless(util.CanonicalLanguage('pt-BR') == 'pt-BR') 49 self.failUnless(util.CanonicalLanguage('pt-BR') == 'pt-BR')
50 self.failUnless(util.CanonicalLanguage('pt/br') == 'pt-BR') 50 self.failUnless(util.CanonicalLanguage('pt/br') == 'pt-BR')
51 self.failUnless(util.CanonicalLanguage('pt/BR') == 'pt-BR') 51 self.failUnless(util.CanonicalLanguage('pt/BR') == 'pt-BR')
52 self.failUnless(util.CanonicalLanguage('no_no_bokmal') == 'no-NO-BOKMAL') 52 self.failUnless(util.CanonicalLanguage('no_no_bokmal') == 'no-NO-BOKMAL')
53 53
54 def testUnescapeHtml(self): 54 def testUnescapeHtml(self):
55 self.failUnless(util.UnescapeHtml('ϲ') == unichr(1010)) 55 self.failUnless(util.UnescapeHtml('ϲ') == unichr(1010))
56 self.failUnless(util.UnescapeHtml('ꯍ') == unichr(43981)) 56 self.failUnless(util.UnescapeHtml('ꯍ') == unichr(43981))
57 57
58 def testRelativePath(self):
59 """ Verify that MakeRelativePath works in some tricky cases."""
60
61 def TestRelativePathCombinations(base_path, other_path, expected_result):
62 """ Verify that the relative path function works for
63 the given paths regardless of whether or not they end with
64 a trailing slash."""
65 for path1 in [base_path, base_path + os.path.sep]:
66 for path2 in [other_path, other_path + os.path.sep]:
67 result = util.MakeRelativePath(path1, path2)
68 self.failUnless(result == expected_result)
69
70 # set-up variables
71 root_dir = 'c:%sa' % os.path.sep
72 result1 = '..%sabc' % os.path.sep
73 path1 = root_dir + 'bc'
74 result2 = 'bc'
75 path2 = '%s%s%s' % (root_dir, os.path.sep, result2)
76 # run the tests
77 TestRelativePathCombinations(root_dir, path1, result1)
78 TestRelativePathCombinations(root_dir, path2, result2)
79
58 class TestBaseClassToLoad(object): 80 class TestBaseClassToLoad(object):
59 pass 81 pass
60 82
61 class TestClassToLoad(TestBaseClassToLoad): 83 class TestClassToLoad(TestBaseClassToLoad):
62 pass 84 pass
63 85
64 class TestClassNoBase(object): 86 class TestClassNoBase(object):
65 pass 87 pass
66 88
67 89
68 if __name__ == '__main__': 90 if __name__ == '__main__':
69 unittest.main() 91 unittest.main()
70 92
OLDNEW
« no previous file with comments | « grit/util.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698