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

Unified Diff: tests/patch_test.py

Issue 9387024: Fix unicode upgrade of patch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Add more test Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « testing_support/patches_data.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/patch_test.py
diff --git a/tests/patch_test.py b/tests/patch_test.py
index 671e5c92579fe035bd619662162cc32c14cf0ad9..41ef0cef104036b5f92dde7659c95d60cc6807ee 100755
--- a/tests/patch_test.py
+++ b/tests/patch_test.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+# coding: utf-8
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -275,6 +276,19 @@ class PatchTest(unittest.TestCase):
p, 'file_b', RAW.MINIMAL_RENAME, source_filename='file_a', is_new=True,
nb_hunks=0)
+ def testUnicodeFilenameGet(self):
+ p = patch.FilePatchDiff(u'filé_b', RAW.RENAME_UTF8, [])
+ self._check_patch(
+ p, u'filé_b', RAW.RENAME_UTF8, source_filename=u'file_à', is_new=True,
+ nb_hunks=1)
+ self.assertTrue(isinstance(p.get(False), str))
+ p.set_relpath('foo')
+ self.assertTrue(isinstance(p.get(False), str))
+ self.assertEquals(u'foo/file_à'.encode('utf-8'), p.source_filename_utf8)
+ self.assertEquals(u'foo/file_à', p.source_filename)
+ self.assertEquals(u'foo/filé_b'.encode('utf-8'), p.filename_utf8)
+ self.assertEquals(u'foo/filé_b', p.filename)
+
def testGitCopyPartial(self):
p = patch.FilePatchDiff('wtf2', GIT.COPY_PARTIAL, [])
self._check_patch(
« no previous file with comments | « testing_support/patches_data.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698