]> khamidou — GitHub mirrors - imapclient.git/commitdiff
deal with unicode literals in tests
authorMenno Smits <menno@freshfoo.com>
Mon, 21 May 2012 21:49:47 +0000 (22:49 +0100)
committerMenno Smits <menno@freshfoo.com>
Mon, 21 May 2012 21:49:47 +0000 (22:49 +0100)
imapclient/test/test_imap_utf7.py
imapclient/test/test_imapclient.py

index 9e310c1bfe82173ea28f04ff52efd14e21ecfaa5..1885c58afc46425d73b2dd13bafa7412040bcdf1 100644 (file)
@@ -2,6 +2,7 @@
 # Released subject to the New BSD License
 # Please see http://en.wikipedia.org/wiki/BSD_licenses
 
+from imapclient.six import u
 from imapclient.imap_utf7 import decode, encode, FolderNameError
 from imapclient.test.util import unittest
 
@@ -10,11 +11,11 @@ class IMAP4UTF7TestCase(unittest.TestCase):
         ['Foo', 'Foo'],
         ['Foo Bar', 'Foo Bar'],
         ['Stuff & Things', 'Stuff &- Things'],
-        [u'Hello world', 'Hello world'],
-        [u'Hello & world', 'Hello &- world'],
-        [u'Hello\xffworld', 'Hello&AP8-world'],
-        [u'\xff\xfe\xfd\xfc', '&AP8A,gD9APw-'],
-        [u'~peter/mail/\u65e5\u672c\u8a9e/\u53f0\u5317',
+        [u('Hello world'), 'Hello world'],
+        [u('Hello & world'), 'Hello &- world'],
+        [u('Hello\xffworld'), 'Hello&AP8-world'],
+        [u('\xff\xfe\xfd\xfc'), '&AP8A,gD9APw-'],
+        [u('~peter/mail/\u65e5\u672c\u8a9e/\u53f0\u5317'),
          '~peter/mail/&ZeVnLIqe-/&U,BTFw-'], # example from RFC 2060
         ['\x00foo', '&AAA-foo'],
     ]
index 0d934259d10976953156d04126145fd29710a19a..59ff60746d6e145d75ed15fb07ffca0a374945dc 100644 (file)
@@ -8,7 +8,7 @@ import sys
 from datetime import datetime
 from StringIO import StringIO
 
-from imapclient.six import advance_iterator
+from imapclient.six import advance_iterator, u
 from imapclient.fixed_offset import FixedOffset
 from imapclient.imapclient import datetime_to_imap
 from imapclient.test.mock import patch, sentinel, Mock
@@ -92,8 +92,8 @@ class TestListFolders(IMAPClientTest):
         folders = self.client._proc_folder_list([('(\\NoInferiors \\UnMarked) "/" {5}', 'bang\xff'),
                                                  '',
                                                  '(\\HasNoChildren \\UnMarked) "/" "INBOX"'])
-        self.assertEqual(folders, [(['\\NoInferiors', '\\UnMarked'], "/", u'bang\xff'),
-                                   (['\\HasNoChildren', '\\UnMarked'], "/", u'INBOX')])
+        self.assertEqual(folders, [(['\\NoInferiors', '\\UnMarked'], "/", u('bang\xff')),
+                                   (['\\HasNoChildren', '\\UnMarked'], "/", u('INBOX'))])
 
 
     def test_quoted_specials(self):
@@ -176,7 +176,7 @@ class TestAclMethods(IMAPClientTest):
     def test_setacl(self):
         self.client._imap.setacl.return_value = ('OK', ["SETACL done"])
 
-        response = self.client.setacl(u'folder', sentinel.who, sentinel.what)
+        response = self.client.setacl(u('folder'), sentinel.who, sentinel.what)
 
         self.client._imap.setacl.assert_called_with('"folder"', sentinel.who, sentinel.what)
         self.assertEqual(response, "SETACL done")