File tree Expand file tree Collapse file tree 2 files changed +3
-9
lines changed
Expand file tree Collapse file tree 2 files changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -5717,9 +5717,7 @@ def test_rfc2231_bad_character_in_encoding(self):
57175717
57185718"""
57195719 msg = email .message_from_string (m )
5720- import warnings
5721- with warnings .catch_warnings ():
5722- warnings .simplefilter ("ignore" , DeprecationWarning )
5720+ with self .assertWarns (DeprecationWarning ):
57235721 self .assertEqual (msg .get_filename (), 'myfile.txt' )
57245722
57255723 def test_rfc2231_single_tick_in_filename_extended (self ):
Original file line number Diff line number Diff line change 11import datetime
22import textwrap
33import unittest
4- import warnings
54from email import errors
65from email import policy
76from email .message import Message
@@ -249,11 +248,8 @@ def content_type_as_value(self,
249248 header = 'Content-Type:' + ' ' if source else ''
250249 folded = args [3 ] if l > 3 else header + decoded + '\n '
251250 # 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 )
251+ if 'utf-8%E2%80%9D' in source and not 'ascii' in source :
252+ with self .assertWarns (DeprecationWarning ):
257253 h = self .make_header ('Content-Type' , source )
258254 else :
259255 h = self .make_header ('Content-Type' , source )
You can’t perform that action at this time.
0 commit comments