bitter-ability-32190
02/01/2022, 5:49 PMbitter-ability-32190
02/01/2022, 5:52 PMstr | None
(and not the accidental str
) there's no way to enforce this. Declaring a variable of type str | None
isn't sufficient as mypy
is happy to "promote" str
to fit into str | None
.bitter-ability-32190
02/01/2022, 5:53 PMassert x is None
followed by some code after it, in which mypy
will complain about unreachable code if x
is type str
.hundreds-father-404
02/01/2022, 5:57 PMpytest
rather than having to use pytest
+ mypy
, so I had no interest
But if it's specifically to test our type hints are correct, cool!bitter-ability-32190
02/01/2022, 5:58 PMbitter-ability-32190
02/01/2022, 5:58 PMmypy
๐
)