libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject git commit: Fix the test so it doesn't fail under Python 2.5.
Date Mon, 04 Nov 2013 20:41:45 GMT
Updated Branches:
  refs/heads/trunk 93fde1568 -> 4b755a8bc


Fix the test so it doesn't fail under Python 2.5.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/4b755a8b
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/4b755a8b
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/4b755a8b

Branch: refs/heads/trunk
Commit: 4b755a8bc089a74907ab0efea70d3d41dd1072f5
Parents: 93fde15
Author: Tomaz Muraus <tomaz@apache.org>
Authored: Mon Nov 4 20:41:14 2013 +0000
Committer: Tomaz Muraus <tomaz@apache.org>
Committed: Mon Nov 4 20:41:14 2013 +0000

----------------------------------------------------------------------
 libcloud/test/test_utils.py | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/4b755a8b/libcloud/test/test_utils.py
----------------------------------------------------------------------
diff --git a/libcloud/test/test_utils.py b/libcloud/test/test_utils.py
index d5a373b..caac295 100644
--- a/libcloud/test/test_utils.py
+++ b/libcloud/test/test_utils.py
@@ -14,11 +14,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# Allows unicode literals ('' == unicode) on Python 2, for compatibility with
-# Python 3
-from __future__ import unicode_literals
-
 import sys
+import codecs
 import unittest
 import warnings
 import os.path
@@ -30,7 +27,7 @@ import libcloud.utils.files
 
 from libcloud.utils.misc import get_driver, set_driver
 
-from libcloud.utils.py3 import PY3
+from libcloud.utils.py3 import PY3, PY32
 from libcloud.utils.py3 import StringIO
 from libcloud.utils.py3 import b
 from libcloud.utils.py3 import urlquote
@@ -212,9 +209,13 @@ class TestUtils(unittest.TestCase):
 
     def test_unicode_urlquote(self):
         # Regression tests for LIBCLOUD-429
+        if PY3:
+            # Note: this is a unicode literal
+            val = '\xe9'
+        else:
+            val = codecs.unicode_escape_decode('\xe9')[0]
 
-        # Note: this is a unicode literal
-        uri = libcloud.utils.py3.urlquote('\xe9')
+        uri = libcloud.utils.py3.urlquote(val)
         self.assertEqual(b(uri), b('%C3%A9'))
 
         # Unicode without unicode characters


Mime
View raw message