-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
Description
Apologies if i'm using the wrong words to describe what i'm trying to recommend/request.
Feature
At the moment, mypy recommends type narrowing using asserts. For example, if something
is Optional[None]
, add assert something is not None
to help mypy type check the statements that follow the assert
.
In tests, instead of adding an additional assert
, can mypy use a unittest.TestCase.assertIsInstance
check?
Pitch
Most unittest-based tests already make use of the assertIsInstance
check so we can prevent the need to add an additional assert
or the need to convert the assertIsInstance
into a assert isinstance(something) is sometype
.
eltoder, OmerFI and ogayot