Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Prev Previous commit
Next Next commit
Fix second warning
  • Loading branch information
StanFromIreland committed Nov 1, 2025
commit 16697dcc6b5f5f0a316fa2e14537d516b9e16bb9
11 changes: 10 additions & 1 deletion Lib/test/test_email/test_headerregistry.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import datetime
import textwrap
import unittest
import warnings
from email import errors
from email import policy
from email.message import Message
Expand Down Expand Up @@ -247,7 +248,15 @@ def content_type_as_value(self,
decoded = args[2] if l>2 and args[2] is not DITTO else source
header = 'Content-Type:' + ' ' if source else ''
folded = args[3] if l>3 else header + decoded + '\n'
h = self.make_header('Content-Type', source)
# Suppress deprecation warning for rfc2231_nonascii_in_charset_of_charset_parameter_value
if 'utf-8%E2%80%9D' in source:
with warnings.catch_warnings():
warnings.filterwarnings('ignore',
message='Support for non-ascii encoding names',
category=DeprecationWarning)
h = self.make_header('Content-Type', source)
else:
h = self.make_header('Content-Type', source)
self.assertEqual(h.content_type, content_type)
self.assertEqual(h.maintype, maintype)
self.assertEqual(h.subtype, subtype)
Expand Down
Loading