cpython icon indicating copy to clipboard operation
cpython copied to clipboard

`test_mailbox`: Duplicate keys in `_sample_headers` cause `_check_sample` to only test one value

Open The-Compiler opened this issue 3 years ago • 0 comments

Bug report

A sample of mail headers is used in tests here:

https://github.com/python/cpython/blob/b2694ab46997746eae7e913738623b39f6334473/Lib/test/test_mailbox.py#L34-L35

However, _sample_headers is defined as a dict, despite having duplicate keys, such as Received:

https://github.com/python/cpython/blob/b2694ab46997746eae7e913738623b39f6334473/Lib/test/test_mailbox.py#L2267-L2290

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 https://github.com/python/cpython/issues/93010#issuecomment-1133402591)

Your environment

  • CPython versions tested on: Seems to be around since ~forever, added to the git repo in 477c8d5e70240744d24631b18341ad892c8a8e1c.
  • Operating system and architecture: Archlinux x86_64
  • PR: gh-93242

The-Compiler avatar May 23 '22 15:05 The-Compiler