Calling unittest.assertDictEqual for medium-size dictionaries takes too long
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- testing-qa
Research direction
Start with the supplied Python reproduction and inspect unittest.assertDictEqual, then read issue #63416 and linked PR gh-126923 for existing context. Done means the medium-size dictionary comparison no longer takes an excessive amount of time, with the behavior checked against the reproduction.
Written by the indexing model from the issue text.
Description
Calling assertDictEqual(d1, d2) / takes forever, even for medium-size dictionaries. To reproduce:
from unittest import TestCase
from random import randint
def test_assert_dict(self):
r = 10000000
num = 10000
d1 = dict((randint(0, r), randint(0, r)) for _ in range(num))
d2 = dict((randint(0, r), randint(0, r)) for _ in range(num))
self.assertDictEqual(d1, d2)
Probably related to issue #63416.
Tested on Python 3.10, Windows 11
Linked PRs
- gh-126923
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 36k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 558
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from python/cpython
-
docs pending
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
stdlib type-feature
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
stdlib type-feature
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
build type-bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
stdlib topic-email type-feature
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100