@@ -3294,6 +3294,29 @@ def test_address_list_with_specials_in_long_quoted_string(self):
32943294 with self .subTest (to = to ):
32953295 self ._test (parser .get_address_list (to )[0 ], folded , policy = policy )
32963296
3297+ def test_address_list_with_long_unwrapable_comment (self ):
3298+ policy = self .policy .clone (max_line_length = 40 )
3299+ cases = [
3300+ # (to, folded)
3301+ ('(loremipsumdolorsitametconsecteturadipi)<spy@example.org>' ,
3302+ '(loremipsumdolorsitametconsecteturadipi)<spy@example.org>\n ' ),
3303+ ('<spy@example.org>(loremipsumdolorsitametconsecteturadipi)' ,
3304+ '<spy@example.org>(loremipsumdolorsitametconsecteturadipi)\n ' ),
3305+ ('(loremipsum dolorsitametconsecteturadipi)<spy@example.org>' ,
3306+ '(loremipsum dolorsitametconsecteturadipi)<spy@example.org>\n ' ),
3307+ ('<spy@example.org>(loremipsum dolorsitametconsecteturadipi)' ,
3308+ '<spy@example.org>(loremipsum\n dolorsitametconsecteturadipi)\n ' ),
3309+ ('(Escaped \\ ( \\ ) chars \\ \\ in comments stay escaped)<spy@example.org>' ,
3310+ '(Escaped \\ ( \\ ) chars \\ \\ in comments stay\n escaped)<spy@example.org>\n ' ),
3311+ ('((loremipsum)(loremipsum)(loremipsum)(loremipsum))<spy@example.org>' ,
3312+ '((loremipsum)(loremipsum)(loremipsum)(loremipsum))<spy@example.org>\n ' ),
3313+ ('((loremipsum)(loremipsum)(loremipsum) (loremipsum))<spy@example.org>' ,
3314+ '((loremipsum)(loremipsum)(loremipsum)\n (loremipsum))<spy@example.org>\n ' ),
3315+ ]
3316+ for (to , folded ) in cases :
3317+ with self .subTest (to = to ):
3318+ self ._test (parser .get_address_list (to )[0 ], folded , policy = policy )
3319+
32973320 # XXX Need tests with comments on various sides of a unicode token,
32983321 # and with unicode tokens in the comments. Spaces inside the quotes
32993322 # currently don't do the right thing.
0 commit comments