зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1452864 - [mozfile] Always use Unicode delimiters for tree() output. r=gbrown
MozReview-Commit-ID: E44O1NGM7Mg --HG-- extra : rebase_source : c3d5932b05ad9099fb563a3ab69c3a610f26755e
This commit is contained in:
Родитель
7524e36b05
Коммит
45a5fa3432
|
@ -252,29 +252,11 @@ def depth(directory):
|
|||
return level
|
||||
|
||||
|
||||
# ASCII delimeters
|
||||
ascii_delimeters = {
|
||||
'vertical_line': '|',
|
||||
'item_marker': '+',
|
||||
'last_child': '\\'
|
||||
}
|
||||
|
||||
# unicode delimiters
|
||||
unicode_delimeters = {
|
||||
'vertical_line': u'│',
|
||||
'item_marker': u'├',
|
||||
'last_child': u'└'
|
||||
}
|
||||
|
||||
|
||||
def tree(directory,
|
||||
item_marker=unicode_delimeters['item_marker'],
|
||||
vertical_line=unicode_delimeters['vertical_line'],
|
||||
last_child=unicode_delimeters['last_child'],
|
||||
sort_key=lambda x: x.lower()):
|
||||
"""
|
||||
display tree directory structure for `directory`
|
||||
"""
|
||||
def tree(directory, sort_key=lambda x: x.lower()):
|
||||
"""Display tree directory structure for `directory`."""
|
||||
vertical_line = u'│'
|
||||
item_marker = u'├'
|
||||
last_child = u'└'
|
||||
|
||||
retval = []
|
||||
indent = []
|
||||
|
|
|
@ -47,7 +47,7 @@ class TestProfilePrint(unittest.TestCase):
|
|||
def test_str_cast(self):
|
||||
"""Test casting to a string."""
|
||||
profile = mozprofile.Profile()
|
||||
self.assertEqual(str(profile), profile.summary().encode("UTF-8"))
|
||||
self.assertEqual(str(profile), profile.summary().encode("utf-8"))
|
||||
|
||||
def test_unicode_cast(self):
|
||||
"""Test casting to a unicode string."""
|
||||
|
|
Загрузка…
Ссылка в новой задаче