@@ -808,9 +808,13 @@ def test_get_atom_atom_ends_at_special(self):
808808 self .assertEqual (atom [2 ].comments , ['bar' ])
809809
810810 def test_get_atom_atom_ends_at_noncfws (self ):
811- atom = self ._test_get_x (parser .get_atom ,
811+ self ._test_get_x (parser .get_atom ,
812812 'bob fred' , 'bob ' , 'bob ' , [], 'fred' )
813813
814+ def test_get_atom_rfc2047_atom (self ):
815+ self ._test_get_x (parser .get_atom ,
816+ '=?utf-8?q?=20bob?=' , ' bob' , ' bob' , [], '' )
817+
814818 # get_dot_atom_text
815819
816820 def test_get_dot_atom_text (self ):
@@ -885,6 +889,10 @@ def test_get_dot_atom_trailing_dot_raises(self):
885889 with self .assertRaises (errors .HeaderParseError ):
886890 parser .get_dot_atom (' (foo) bar.bang. foo' )
887891
892+ def test_get_dot_atom_rfc2047_atom (self ):
893+ self ._test_get_x (parser .get_dot_atom ,
894+ '=?utf-8?q?=20bob?=' , ' bob' , ' bob' , [], '' )
895+
888896 # get_word (if this were black box we'd repeat all the qs/atom tests)
889897
890898 def test_get_word_atom_yields_atom (self ):
@@ -2156,6 +2164,22 @@ def test_get_address_complex(self):
21562164 self .assertEqual (address [0 ].token_type ,
21572165 'mailbox' )
21582166
2167+ def test_get_address_rfc2047_display_name (self ):
2168+ address = self ._test_get_x (parser .get_address ,
2169+ '=?utf-8?q?=C3=89ric?= <[email protected] >' ,
2170+ 2171+ 2172+ [],
2173+ '' )
2174+ self .assertEqual (address .token_type , 'address' )
2175+ self .assertEqual (len (address .mailboxes ), 1 )
2176+ self .assertEqual (address .mailboxes ,
2177+ address .all_mailboxes )
2178+ self .assertEqual (address .mailboxes [0 ].display_name ,
2179+ 'Éric' )
2180+ self .assertEqual (address [0 ].token_type ,
2181+ 'mailbox' )
2182+
21592183 def test_get_address_empty_group (self ):
21602184 address = self ._test_get_x (parser .get_address ,
21612185 'Monty Python:;' ,
0 commit comments