3 ms·
> 1. If you have a good test suite, mypy adds less value than it costs. > 2. If you don't have a good test suite, you really need to get one. > How am I wrong
by webmaven 6y ago
> 1. If you have a good test suite, mypy adds less value than it costs.
> 2. If you don't have a good test suite, you really need to get one.
> How am I wrong?
You're not wrong, per-se, but there is an excluded-middle fallacy here:
If you have a good test suite (that already includes tests for the types of returned values), then mypy may indeed add less value than it costs.
If you don't have a good test suite, you do indeed need to get one.
However.
Mypy is very likely to reduce the cost of adding a good test suite, as it obviates the need for making type assertions in the tests by instead allowing those assertions of various types to be made inline with the code as type annotations.
This makes the remaining functional and unit tests shorter and a lot more readable.