File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 11import datetime
22import textwrap
33import unittest
4+ import warnings
45from email import errors
56from email import policy
67from email .message import Message
@@ -247,7 +248,15 @@ def content_type_as_value(self,
247248 decoded = args [2 ] if l > 2 and args [2 ] is not DITTO else source
248249 header = 'Content-Type:' + ' ' if source else ''
249250 folded = args [3 ] if l > 3 else header + decoded + '\n '
250- h = self .make_header ('Content-Type' , source )
251+ # Suppress deprecation warning for rfc2231_nonascii_in_charset_of_charset_parameter_value
252+ if 'utf-8%E2%80%9D' in source :
253+ with warnings .catch_warnings ():
254+ warnings .filterwarnings ('ignore' ,
255+ message = 'Support for non-ascii encoding names' ,
256+ category = DeprecationWarning )
257+ h = self .make_header ('Content-Type' , source )
258+ else :
259+ h = self .make_header ('Content-Type' , source )
251260 self .assertEqual (h .content_type , content_type )
252261 self .assertEqual (h .maintype , maintype )
253262 self .assertEqual (h .subtype , subtype )
You can’t perform that action at this time.
0 commit comments