You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2013/11/04 21:41:45 UTC

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

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 <to...@apache.org>
Authored: Mon Nov 4 20:41:14 2013 +0000
Committer: Tomaz Muraus <to...@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