Show
Ignore:
Timestamp:
05/01/10 13:42:35 (2 years ago)
Author:
Menno Smits <menno@…>
Branch:
default
Message:

Fixed problem when literal is followed by a non-literal (#33)

This problem manifested itself with GMail's IMAP. Patch based on what
Fergal sent in with the bug report.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • imapclient/test/test_FetchParser.py

    r90 r96  
    180180 
    181181    def testMultiTypesWithLiteral(self): 
    182         self._parse_test( 
    183             [ 
    184                 ('1 (INTERNALDATE " 9-Feb-2007 17:08:08 +0100" RFC822 {21}', 
    185                       'Subject: test\r\n\r\nbody'), 
    186                 ')' 
    187                 ], 
    188             {1: { 
    189                     'INTERNALDATE': datetime_to_native(datetime.datetime(2007, 2, 9, 
    190                                                                          17, 8, 8, 0, 
    191                                                                          FixedOffset(60))), 
    192                     'RFC822': 'Subject: test\r\n\r\nbody', 
     182        expected = {1: {'INTERNALDATE': datetime_to_native(datetime.datetime(2007, 2, 9, 
     183                                                                             17, 8, 8, 0, 
     184                                                                             FixedOffset(60))), 
     185                        'RFC822': 'Subject: test\r\n\r\nbody'} 
    193186                    } 
    194                 } 
    195             ) 
     187        self._parse_test([('1 (INTERNALDATE " 9-Feb-2007 17:08:08 +0100" RFC822 {21}', 
     188                           'Subject: test\r\n\r\nbody'), ')'], 
     189                         expected) 
     190 
     191        # Also test where there literal comes back first 
     192        self._parse_test([('1 (RFC822 {21}', 'Subject: test\r\n\r\nbody'), 
     193                           'INTERNALDATE " 9-Feb-2007 17:08:08 +0100")'], 
     194                           expected) 
    196195 
    197196    def testLiteralsWithSections(self):