From 71882527c6ad8e4492b59d88df15b8366d648114 Mon Sep 17 00:00:00 2001 From: Abdul Zainul Abedin Date: Wed, 25 May 2022 23:16:04 -0400 Subject: [PATCH 1/6] changed _sample_headers from a map to list + tuples to allow duplicate keys --- Lib/test/test_mailbox.py | 44 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py index 07c2764dfd1b2f..8ba7ffac8519c5 100644 --- a/Lib/test/test_mailbox.py +++ b/Lib/test/test_mailbox.py @@ -31,7 +31,7 @@ def _check_sample(self, msg): # Inspect a mailbox.Message representation of the sample message self.assertIsInstance(msg, email.message.Message) self.assertIsInstance(msg, mailbox.Message) - for key, value in _sample_headers.items(): + for key, value in _sample_headers: self.assertIn(value, msg.get_all(key)) self.assertTrue(msg.is_multipart()) self.assertEqual(len(msg.get_payload()), len(_sample_payloads)) @@ -2264,30 +2264,30 @@ def test_nonempty_maildir_both(self): _bytes_sample_message = _sample_message.encode('ascii') -_sample_headers = { - "Return-Path":"", - "X-Original-To":"gkj+person@localhost", - "Delivered-To":"gkj+person@localhost", - "Received":"""from localhost (localhost [127.0.0.1]) +_sample_headers = [ + ("Return-Path", ""), + ("X-Original-To", "gkj+person@localhost"), + ("Delivered-To", "gkj+person@localhost"), + ("Received", """from localhost (localhost [127.0.0.1]) by andy.gregorykjohnson.com (Postfix) with ESMTP id 356ED9DD17 - for ; Wed, 13 Jul 2005 17:23:16 -0400 (EDT)""", - "Delivered-To":"gkj@sundance.gregorykjohnson.com", - "Received":"""from localhost [127.0.0.1] + for ; Wed, 13 Jul 2005 17:23:16 -0400 (EDT)"""), + ("Delivered-To", "gkj@sundance.gregorykjohnson.com"), + ("Received", """from localhost [127.0.0.1] by localhost with POP3 (fetchmail-6.2.5) - for gkj+person@localhost (single-drop); Wed, 13 Jul 2005 17:23:16 -0400 (EDT)""", - "Received":"""from andy.gregorykjohnson.com (andy.gregorykjohnson.com [64.32.235.228]) + for gkj+person@localhost (single-drop); Wed, 13 Jul 2005 17:23:16 -0400 (EDT)"""), + ("Received", """from andy.gregorykjohnson.com (andy.gregorykjohnson.com [64.32.235.228]) by sundance.gregorykjohnson.com (Postfix) with ESMTP id 5B056316746 - for ; Wed, 13 Jul 2005 17:23:11 -0400 (EDT)""", - "Received":"""by andy.gregorykjohnson.com (Postfix, from userid 1000) - id 490CD9DD17; Wed, 13 Jul 2005 17:23:11 -0400 (EDT)""", - "Date":"Wed, 13 Jul 2005 17:23:11 -0400", - "From":""""Gregory K. Johnson" """, - "To":"gkj@gregorykjohnson.com", - "Subject":"Sample message", - "Mime-Version":"1.0", - "Content-Type":"""multipart/mixed; boundary="NMuMz9nt05w80d4+\"""", - "Content-Disposition":"inline", - "User-Agent": "Mutt/1.5.9i" } + for ; Wed, 13 Jul 2005 17:23:11 -0400 (EDT)"""), + ("Received", """by andy.gregorykjohnson.com (Postfix, from userid 1000) + id 490CD9DD17; Wed, 13 Jul 2005 17:23:11 -0400 (EDT)"""), + ("Date", "Wed, 13 Jul 2005 17:23:11 -0400"), + ("From", """"Gregory K. Johnson" """), + ("To", "gkj@gregorykjohnson.com"), + ("Subject", "Sample message"), + ("Mime-Version", "1.0"), + ("Content-Type", """multipart/mixed; boundary="NMuMz9nt05w80d4+\""""), + ("Content-Disposition", "inline"), + ("User-Agent", "Mutt/1.5.9i")] _sample_payloads = ("""This is a sample message. From a5d36df144d4dc2c917a66ac01839619dd39ae32 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Sat, 28 May 2022 03:52:09 +0000 Subject: [PATCH 2/6] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Tests/2022-05-28-03-52-08.gh-issue-93121.JsYqsI.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Tests/2022-05-28-03-52-08.gh-issue-93121.JsYqsI.rst diff --git a/Misc/NEWS.d/next/Tests/2022-05-28-03-52-08.gh-issue-93121.JsYqsI.rst b/Misc/NEWS.d/next/Tests/2022-05-28-03-52-08.gh-issue-93121.JsYqsI.rst new file mode 100644 index 00000000000000..6400a0cd887440 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2022-05-28-03-52-08.gh-issue-93121.JsYqsI.rst @@ -0,0 +1 @@ +Since _sample_headers is a map with duplicate keys (ex: Received), not all keys are tested. Changed _sample_headers to a list of tuples so all keys are tested From d3cb1ab78c6eb3ddd3a97dd40578357ee97d107c Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Sat, 28 May 2022 03:52:50 +0000 Subject: [PATCH 3/6] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Tests/2022-05-28-03-52-49.gh-issue-93121.JsYqsI.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Tests/2022-05-28-03-52-49.gh-issue-93121.JsYqsI.rst diff --git a/Misc/NEWS.d/next/Tests/2022-05-28-03-52-49.gh-issue-93121.JsYqsI.rst b/Misc/NEWS.d/next/Tests/2022-05-28-03-52-49.gh-issue-93121.JsYqsI.rst new file mode 100644 index 00000000000000..6400a0cd887440 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2022-05-28-03-52-49.gh-issue-93121.JsYqsI.rst @@ -0,0 +1 @@ +Since _sample_headers is a map with duplicate keys (ex: Received), not all keys are tested. Changed _sample_headers to a list of tuples so all keys are tested From 1c2a2012c09be9b70afb7de14f7848392521ac6c Mon Sep 17 00:00:00 2001 From: AGZain <31054801+AGZain@users.noreply.github.com> Date: Sat, 28 May 2022 09:53:29 -0400 Subject: [PATCH 4/6] Styling updates Lib/test/test_mailbox.py Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- Lib/test/test_mailbox.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py index 8ba7ffac8519c5..4c592eaf34da23 100644 --- a/Lib/test/test_mailbox.py +++ b/Lib/test/test_mailbox.py @@ -2287,7 +2287,8 @@ def test_nonempty_maildir_both(self): ("Mime-Version", "1.0"), ("Content-Type", """multipart/mixed; boundary="NMuMz9nt05w80d4+\""""), ("Content-Disposition", "inline"), - ("User-Agent", "Mutt/1.5.9i")] + ("User-Agent", "Mutt/1.5.9i"), +] _sample_payloads = ("""This is a sample message. From 1ea1785bc5d9658b77166d8f4cfc0ba92e9bcb1a Mon Sep 17 00:00:00 2001 From: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Date: Wed, 9 Nov 2022 11:22:16 +0000 Subject: [PATCH 5/6] Delete duplicate news file --- .../next/Tests/2022-05-28-03-52-49.gh-issue-93121.JsYqsI.rst | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Misc/NEWS.d/next/Tests/2022-05-28-03-52-49.gh-issue-93121.JsYqsI.rst diff --git a/Misc/NEWS.d/next/Tests/2022-05-28-03-52-49.gh-issue-93121.JsYqsI.rst b/Misc/NEWS.d/next/Tests/2022-05-28-03-52-49.gh-issue-93121.JsYqsI.rst deleted file mode 100644 index 6400a0cd887440..00000000000000 --- a/Misc/NEWS.d/next/Tests/2022-05-28-03-52-49.gh-issue-93121.JsYqsI.rst +++ /dev/null @@ -1 +0,0 @@ -Since _sample_headers is a map with duplicate keys (ex: Received), not all keys are tested. Changed _sample_headers to a list of tuples so all keys are tested From 4995a871e9dd4a993a566cc915921c230d960aed Mon Sep 17 00:00:00 2001 From: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Date: Thu, 6 Apr 2023 21:47:13 +0100 Subject: [PATCH 6/6] Minor test changes don't require a news file --- .../next/Tests/2022-05-28-03-52-08.gh-issue-93121.JsYqsI.rst | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Misc/NEWS.d/next/Tests/2022-05-28-03-52-08.gh-issue-93121.JsYqsI.rst diff --git a/Misc/NEWS.d/next/Tests/2022-05-28-03-52-08.gh-issue-93121.JsYqsI.rst b/Misc/NEWS.d/next/Tests/2022-05-28-03-52-08.gh-issue-93121.JsYqsI.rst deleted file mode 100644 index 6400a0cd887440..00000000000000 --- a/Misc/NEWS.d/next/Tests/2022-05-28-03-52-08.gh-issue-93121.JsYqsI.rst +++ /dev/null @@ -1 +0,0 @@ -Since _sample_headers is a map with duplicate keys (ex: Received), not all keys are tested. Changed _sample_headers to a list of tuples so all keys are tested