-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
Closed
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtopic-emailtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
A sample of mail headers is used in tests here:
cpython/Lib/test/test_mailbox.py
Lines 34 to 35 in b2694ab
| for key, value in _sample_headers.items(): | |
| self.assertIn(value, msg.get_all(key)) |
However, _sample_headers is defined as a dict, despite having duplicate keys, such as Received:
cpython/Lib/test/test_mailbox.py
Lines 2267 to 2290 in b2694ab
| _sample_headers = { | |
| "Return-Path":"<gkj@gregorykjohnson.com>", | |
| "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 <gkj+person@localhost>; 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]) | |
| by sundance.gregorykjohnson.com (Postfix) with ESMTP id 5B056316746 | |
| for <gkj@gregorykjohnson.com>; 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" <gkj@gregorykjohnson.com>""", | |
| "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" } |
causing those tests to only check one of those values. It should probably be a list of tuples instead? If this is indeed unintended, I'd be happy to open a PR.
cc @warsaw
(Found by running flake8 over Lib/ out of curiosity, see #93010 (comment))
Your environment
- CPython versions tested on: Seems to be around since ~forever, added to the git repo in 477c8d5.
- Operating system and architecture: Archlinux x86_64
Metadata
Metadata
Assignees
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtopic-emailtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error