typeshed icon indicating copy to clipboard operation
typeshed copied to clipboard

TypeDict and `Mapping[Any, object]` incompatibilities for `unittest.assertDictEqual`

Open SamuelMarks opened this issue 2 years ago • 1 comments

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?

SamuelMarks avatar Dec 11 '23 22:12 SamuelMarks

Could you give a full example and the type checker (plus version) you are using? I just tried some examples with mypy 1.7.1 and that seemed to work.

srittau avatar Dec 12 '23 10:12 srittau