From 90c19f592786a17de7ff336231962cc76de95b24 Mon Sep 17 00:00:00 2001 From: Menno Smits Date: Mon, 21 May 2012 22:49:47 +0100 Subject: [PATCH] deal with unicode literals in tests --- imapclient/test/test_imap_utf7.py | 11 ++++++----- imapclient/test/test_imapclient.py | 8 ++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/imapclient/test/test_imap_utf7.py b/imapclient/test/test_imap_utf7.py index 9e310c1..1885c58 100644 --- a/imapclient/test/test_imap_utf7.py +++ b/imapclient/test/test_imap_utf7.py @@ -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'], ] diff --git a/imapclient/test/test_imapclient.py b/imapclient/test/test_imapclient.py index 0d93425..59ff607 100644 --- a/imapclient/test/test_imapclient.py +++ b/imapclient/test/test_imapclient.py @@ -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") -- 2.43.0