From: Menno Smits Date: Sun, 24 Jan 2010 18:50:38 +0000 (+0000) Subject: re-enabled more literal tests X-Git-Tag: 0.7~59^2~4 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=28ee2c884d2cdaa169b6bd35e85e1777d428ac85;p=imapclient.git re-enabled more literal tests --- diff --git a/imapclient/test/test_response_parser.py b/imapclient/test/test_response_parser.py index f83edc7..fd0f67b 100644 --- a/imapclient/test/test_response_parser.py +++ b/imapclient/test/test_response_parser.py @@ -232,6 +232,21 @@ class TestParseFetchResponse(unittest.TestCase): }) + def test_literals(self): + self.assertEquals(parse_fetch_response([('1 (RFC822.TEXT {4}', 'body'), + (' RFC822 {21}', 'Subject: test\r\n\r\nbody'), + ')']), + {1: {'RFC822.TEXT': 'body', + 'RFC822': 'Subject: test\r\n\r\nbody', + 'SEQ': 1}}) + + + def test_literals_and_keys_with_square_brackets(self): + self.assertEquals(parse_fetch_response([('1 (BODY[TEXT] {11}', 'Hi there.\r\n'), ')']), + { 1: {'BODY[TEXT]': 'Hi there.\r\n', + 'SEQ': 1}}) + + def test_INTERNALDATE(self): self.fail() @@ -258,27 +273,6 @@ class TestParseFetchResponse(unittest.TestCase): # datetime.datetime(2007, 12, 9, 17, 8, 8, 0, FixedOffset(0))) -# def testLiteral(self): -# '''Test literal handling -# ''' -# self._parse_test( -# [('1 (RFC822 {21}', 'Subject: test\r\n\r\nbody'), ')'], -# { 1: {'RFC822': 'Subject: test\r\n\r\nbody'} } -# ) - -# def testMultipleLiterals(self): -# self._parse_test( -# [ -# ('1 (RFC822.TEXT {4}', 'body'), -# (' RFC822 {21}', 'Subject: test\r\n\r\nbody'), -# ')' -# ], -# { 1: { -# 'RFC822.TEXT': 'body', -# 'RFC822': 'Subject: test\r\n\r\nbody', -# } -# } -# ) # def testMultiTypesWithLiteral(self): # self._parse_test( @@ -296,22 +290,6 @@ class TestParseFetchResponse(unittest.TestCase): # } # ) -# def testLiteralsWithSections(self): -# self._parse_test( -# [('1 (BODY[TEXT] {11}', 'Hi there.\r\n'), ')'], -# { 1: {'BODY[TEXT]': 'Hi there.\r\n',} } -# ) - -# def testLiteralsWithSectionsAndOtherParts(self): -# self._parse_test( -# [('1 (FLAGS (\\Seen) UID 2 BODY[HEADER.FIELDS (FROM)] {21}', -# 'From: foo@foo.com\r\n'), ')'], -# {2: { 'BODY[HEADER.FIELDS (FROM)]': 'From: foo@foo.com\r\n', -# 'FLAGS': ['\\Seen'], -# } -# } -# ) - def format_error(input_, output, expected):