test_00_imaputil.py Runs fine

This patch changes the bytes to strings in test_00 and now
these tests run fine.

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This commit is contained in:
Rodolfo García Peñas (kix) 2020-10-25 18:11:01 +01:00
parent 47f7b1ba3c
commit 8dfef62db4

View File

@ -58,39 +58,39 @@ class TestInternalFunctions(unittest.TestCase):
def test_01_imapsplit(self): def test_01_imapsplit(self):
"""Test imaputil.imapsplit()""" """Test imaputil.imapsplit()"""
res = imaputil.imapsplit(b'(\\HasNoChildren) "." "INBOX.Sent"') res = imaputil.imapsplit('(\\HasNoChildren) "." "INBOX.Sent"')
self.assertEqual(res, [b'(\\HasNoChildren)', b'"."', b'"INBOX.Sent"']) self.assertEqual(res, ['(\\HasNoChildren)', '"."', '"INBOX.Sent"'])
res = imaputil.imapsplit(b'"mo\\" o" sdfsdf') res = imaputil.imapsplit('"mo\\" o" sdfsdf')
self.assertEqual(res, [b'"mo\\" o"', b'sdfsdf']) self.assertEqual(res, ['"mo\\" o"', 'sdfsdf'])
def test_02_flagsplit(self): def test_02_flagsplit(self):
"""Test imaputil.flagsplit()""" """Test imaputil.flagsplit()"""
res = imaputil.flagsplit(b'(\\Draft \\Deleted)') res = imaputil.flagsplit('(\\Draft \\Deleted)')
self.assertEqual(res, [b'\\Draft', b'\\Deleted']) self.assertEqual(res, ['\\Draft', '\\Deleted'])
res = imaputil.flagsplit(b'(FLAGS (\\Seen Old) UID 4807)') res = imaputil.flagsplit('(FLAGS (\\Seen Old) UID 4807)')
self.assertEqual(res, [b'FLAGS', b'(\\Seen Old)', b'UID', b'4807']) self.assertEqual(res, ['FLAGS', '(\\Seen Old)', 'UID', '4807'])
def test_04_flags2hash(self): def test_04_flags2hash(self):
"""Test imaputil.flags2hash()""" """Test imaputil.flags2hash()"""
res = imaputil.flags2hash(b'(FLAGS (\\Seen Old) UID 4807)') res = imaputil.flags2hash('(FLAGS (\\Seen Old) UID 4807)')
self.assertEqual(res, {b'FLAGS': b'(\\Seen Old)', b'UID': b'4807'}) self.assertEqual(res, {'FLAGS': '(\\Seen Old)', 'UID': '4807'})
def test_05_flagsimap2maildir(self): def test_05_flagsimap2maildir(self):
"""Test imaputil.flagsimap2maildir()""" """Test imaputil.flagsimap2maildir()"""
res = imaputil.flagsimap2maildir(b'(\\Draft \\Deleted)') res = imaputil.flagsimap2maildir('(\\Draft \\Deleted)')
self.assertEqual(res, set(b'DT')) self.assertEqual(res, set('DT'))
def test_06_flagsmaildir2imap(self): def test_06_flagsmaildir2imap(self):
"""Test imaputil.flagsmaildir2imap()""" """Test imaputil.flagsmaildir2imap()"""
res = imaputil.flagsmaildir2imap(set(b'DR')) res = imaputil.flagsmaildir2imap(set('DR'))
self.assertEqual(res, b'(\\Answered \\Draft)') self.assertEqual(res, '(\\Answered \\Draft)')
# test all possible flags # test all possible flags
res = imaputil.flagsmaildir2imap(set(b'SRFTD')) res = imaputil.flagsmaildir2imap(set('SRFTD'))
self.assertEqual(res, b'(\\Answered \\Deleted \\Draft \\Flagged \\Seen)') self.assertEqual(res, '(\\Answered \\Deleted \\Draft \\Flagged \\Seen)')
def test_07_uid_sequence(self): def test_07_uid_sequence(self):
"""Test imaputil.uid_sequence()""" """Test imaputil.uid_sequence()"""
res = imaputil.uid_sequence([1, 2, 3, 4, 5, 10, 12, 13]) res = imaputil.uid_sequence([1, 2, 3, 4, 5, 10, 12, 13])
self.assertEqual(res, b'1:5,10,12:13') self.assertEqual(res, '1:5,10,12:13')