Using six.u('') instead of u''

In a few places, there's some u'' strings, this patch replaces
them by six.u(''), as this fixes things when running the unit
tests in Debian Wheezy.

Change-Id: I60c01f85901a33a0e3e7a255049084126558f031
This commit is contained in:
Thomas Goirand
2014-06-15 11:14:08 +08:00
parent f83115b4a6
commit 2d1cc87803
2 changed files with 3 additions and 3 deletions

View File

@@ -119,7 +119,7 @@ V3_VERSION = {'id': 'v3.0',
'status': 'stable', 'status': 'stable',
'updated': UPDATED} 'updated': UPDATED}
V3_TOKEN = u'3e2813b7ba0b4006840c3825860b86ed', V3_TOKEN = six.u('3e2813b7ba0b4006840c3825860b86ed'),
V3_AUTH_RESPONSE = jsonutils.dumps({ V3_AUTH_RESPONSE = jsonutils.dumps({
"token": { "token": {
"methods": [ "methods": [

View File

@@ -114,7 +114,7 @@ class PrintTestCase(test_utils.TestCase):
self.addCleanup(setattr, sys, 'stdout', self.old_stdout) self.addCleanup(setattr, sys, 'stdout', self.old_stdout)
def test_print_list_unicode(self): def test_print_list_unicode(self):
name = u'\u540d\u5b57' name = six.u('\u540d\u5b57')
objs = [FakeObject(name)] objs = [FakeObject(name)]
# NOTE(Jeffrey4l) If the text's encode is proper, this method will not # NOTE(Jeffrey4l) If the text's encode is proper, this method will not
# raise UnicodeEncodeError exceptions # raise UnicodeEncodeError exceptions
@@ -127,7 +127,7 @@ class PrintTestCase(test_utils.TestCase):
self.assertIn(name, output) self.assertIn(name, output)
def test_print_dict_unicode(self): def test_print_dict_unicode(self):
name = u'\u540d\u5b57' name = six.u('\u540d\u5b57')
utils.print_dict({'name': name}) utils.print_dict({'name': name})
output = self.stdout.getvalue() output = self.stdout.getvalue()
# In Python 2, output will be bytes, while in Python 3, it will not. # In Python 2, output will be bytes, while in Python 3, it will not.