TypeDict and `Mapping[Any, object]` incompatibilities for `unittest.assertDictEqual`
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.1k
- Forks
- 2.1k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 82
Description
I've just added types to the common dictionary used throughout my codebase. But now my assertDictEqual gives a type error:
Expected type 'Mapping[Any, object]', got 'MyDictTypeName' instead
What's the trick here? - Should I narrow the types with a Union?
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.
Research direction
The issue names unittest.assertDictEqual but does not identify a file or test. Start by locating its typeshed stub and reproducing the reported incompatibility with a typed dictionary; done means the supported call no longer produces the reported type error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100