@@ -3141,6 +3141,29 @@ def test_address_list_with_specials_in_long_quoted_string(self):
31413141 with self .subTest (to = to ):
31423142 self ._test (parser .get_address_list (to )[0 ], folded , policy = policy )
31433143
3144+ def test_address_list_with_long_unwrapable_comment (self ):
3145+ policy = self .policy .clone (max_line_length = 40 )
3146+ cases = [
3147+ # (to, folded)
3148+ ('(loremipsumdolorsitametconsecteturadipi)<spy@example.org>' ,
3149+ '(loremipsumdolorsitametconsecteturadipi)<spy@example.org>\n ' ),
3150+ ('<spy@example.org>(loremipsumdolorsitametconsecteturadipi)' ,
3151+ '<spy@example.org>(loremipsumdolorsitametconsecteturadipi)\n ' ),
3152+ ('(loremipsum dolorsitametconsecteturadipi)<spy@example.org>' ,
3153+ '(loremipsum dolorsitametconsecteturadipi)<spy@example.org>\n ' ),
3154+ ('<spy@example.org>(loremipsum dolorsitametconsecteturadipi)' ,
3155+ '<spy@example.org>(loremipsum\n dolorsitametconsecteturadipi)\n ' ),
3156+ ('(Escaped \\ ( \\ ) chars \\ \\ in comments stay escaped)<spy@example.org>' ,
3157+ '(Escaped \\ ( \\ ) chars \\ \\ in comments stay\n escaped)<spy@example.org>\n ' ),
3158+ ('((loremipsum)(loremipsum)(loremipsum)(loremipsum))<spy@example.org>' ,
3159+ '((loremipsum)(loremipsum)(loremipsum)(loremipsum))<spy@example.org>\n ' ),
3160+ ('((loremipsum)(loremipsum)(loremipsum) (loremipsum))<spy@example.org>' ,
3161+ '((loremipsum)(loremipsum)(loremipsum)\n (loremipsum))<spy@example.org>\n ' ),
3162+ ]
3163+ for (to , folded ) in cases :
3164+ with self .subTest (to = to ):
3165+ self ._test (parser .get_address_list (to )[0 ], folded , policy = policy )
3166+
31443167 # XXX Need tests with comments on various sides of a unicode token,
31453168 # and with unicode tokens in the comments. Spaces inside the quotes
31463169 # currently don't do the right thing.
0 commit comments