Temporary fix for unicode literal breaking test.
authorCory Benfield <lukasaoz@gmail.com>
Tue, 19 Jun 2012 17:09:22 +0000 (18:09 +0100)
committerCory Benfield <lukasaoz@gmail.com>
Tue, 19 Jun 2012 17:36:35 +0000 (18:36 +0100)
tests/test_requests.py

index a06a783..d9a820d 100755 (executable)
@@ -351,7 +351,14 @@ class RequestsTestSuite(TestSetup, TestBaseMixin, unittest.TestCase):
             post5 = post(url, files={'file': ('file.txt', 'more fdata')})
             self.assertEqual(post5.status_code, 200)
 
-            post6 = post(url, files={'fname.txt': '\xe9'})
+            # Dirty hack to tide us over until 3.3.
+            # TODO: Remove this hack when Python 3.3 is released.
+            if (sys.version_info[0] == 2):
+                fdata = '\xc3\xa9'.decode('utf-8')
+            else:
+                fdata = '\xe9'
+
+            post6 = post(url, files={'fname.txt': fdata})
             self.assertEqual(post6.status_code, 200)
 
             post7 = post(url, files={'fname.txt': 'fdata to verify'})