Matej Cepl 2023-08-12 16:42:26 +00:00 committed by Git OBS Bridge
parent 1912a70570
commit 95848c308a

View File

@ -13,11 +13,11 @@ See https://github.com/python/cpython/issues/106669..
Co-authored-by: Gregory P. Smith <greg@krypto.org>
---
Doc/library/email.utils.rst | 24 ---
Lib/email/test/test_email.py | 52 +++++--
Lib/email/test/test_email.py | 18 ++
Lib/email/test/test_email_renamed.py | 4
Lib/email/utils.py | 66 ----------
Misc/NEWS.d/next/Security/2023-06-13-20-52-24.gh-issue-102988.Kei7Vf.rst | 5
5 files changed, 49 insertions(+), 102 deletions(-)
5 files changed, 32 insertions(+), 85 deletions(-)
create mode 100644 Misc/NEWS.d/next/Security/2023-06-13-20-52-24.gh-issue-102988.Kei7Vf.rst
--- a/Doc/library/email.utils.rst
@ -62,82 +62,6 @@ Co-authored-by: Gregory P. Smith <greg@krypto.org>
--- a/Lib/email/test/test_email.py
+++ b/Lib/email/test/test_email.py
@@ -2297,58 +2297,58 @@ class TestMiscellaneous(TestEmailBase):
obsoletes RFC822) requires four-digit years.
"""
- self.assertEqual(Utils.parsedate_tz('25 Feb 03 13:47:26 -0800'),
- Utils.parsedate_tz('25 Feb 2003 13:47:26 -0800'))
- self.assertEqual(Utils.parsedate_tz('25 Feb 71 13:47:26 -0800'),
- Utils.parsedate_tz('25 Feb 1971 13:47:26 -0800'))
+ self.assertEqual(utils.parsedate_tz('25 Feb 03 13:47:26 -0800'),
+ utils.parsedate_tz('25 Feb 2003 13:47:26 -0800'))
+ self.assertEqual(utils.parsedate_tz('25 Feb 71 13:47:26 -0800'),
+ utils.parsedate_tz('25 Feb 1971 13:47:26 -0800'))
def test_parseaddr_empty(self):
- self.assertEqual(Utils.parseaddr('<>'), ('', ''))
- self.assertEqual(Utils.formataddr(Utils.parseaddr('<>')), '')
+ self.assertEqual(utils.parseaddr('<>'), ('', ''))
+ self.assertEqual(utils.formataddr(utils.parseaddr('<>')), '')
def test_parseaddr_multiple_domains(self):
self.assertEqual(
- Utils.parseaddr('a@b@c'),
+ utils.parseaddr('a@b@c'),
('', '')
)
self.assertEqual(
- Utils.parseaddr('a@b.c@c'),
+ utils.parseaddr('a@b.c@c'),
('', '')
)
self.assertEqual(
- Utils.parseaddr('a@172.17.0.1@c'),
+ utils.parseaddr('a@172.17.0.1@c'),
('', '')
)
def test_noquote_dump(self):
self.assertEqual(
- Utils.formataddr(('A Silly Person', 'person@dom.ain')),
+ utils.formataddr(('A Silly Person', 'person@dom.ain')),
'A Silly Person <person@dom.ain>')
def test_escape_dump(self):
self.assertEqual(
- Utils.formataddr(('A (Very) Silly Person', 'person@dom.ain')),
+ utils.formataddr(('A (Very) Silly Person', 'person@dom.ain')),
r'"A \(Very\) Silly Person" <person@dom.ain>')
a = r'A \(Special\) Person'
b = 'person@dom.ain'
- self.assertEqual(Utils.parseaddr(Utils.formataddr((a, b))), (a, b))
+ self.assertEqual(utils.parseaddr(utils.formataddr((a, b))), (a, b))
def test_escape_backslashes(self):
self.assertEqual(
- Utils.formataddr(('Arthur \Backslash\ Foobar', 'person@dom.ain')),
+ utils.formataddr(('Arthur \Backslash\ Foobar', 'person@dom.ain')),
r'"Arthur \\Backslash\\ Foobar" <person@dom.ain>')
a = r'Arthur \Backslash\ Foobar'
b = 'person@dom.ain'
- self.assertEqual(Utils.parseaddr(Utils.formataddr((a, b))), (a, b))
+ self.assertEqual(utils.parseaddr(utils.formataddr((a, b))), (a, b))
def test_name_with_dot(self):
x = 'John X. Doe <jxd@example.com>'
y = '"John X. Doe" <jxd@example.com>'
a, b = ('John X. Doe', 'jxd@example.com')
- self.assertEqual(Utils.parseaddr(x), (a, b))
- self.assertEqual(Utils.parseaddr(y), (a, b))
+ self.assertEqual(utils.parseaddr(x), (a, b))
+ self.assertEqual(utils.parseaddr(y), (a, b))
# formataddr() quotes the name if there's a dot in it
- self.assertEqual(Utils.formataddr((a, b)), y)
+ self.assertEqual(utils.formataddr((a, b)), y)
def test_parseaddr_preserves_quoted_pairs_in_addresses(self):
# issue 10005. Note that in the third test the second pair of
@@ -2414,6 +2414,24 @@ Foo
[('Al Person', 'aperson@dom.ain'),
('Bud Person', 'bperson@dom.ain')])