3 ms·
> A very high percentage of unit tests in a dynamic language are written to catch type errors. Absolutly not. If you do it you are doing it wrong. Check this
by sametmax 10y ago
> A very high percentage of unit tests in a dynamic language are written to catch type errors.
Absolutly not.
If you do it you are doing it wrong.
Check this out: https://github.com/Tygs/tygs/blob/master/tests/test_components.py https://github.com/Tygs/tygs/blob/master/tests/test_componen...
The type checks are "isinstance". It's 10% of the checks, and most of the time I don't even have those, my colleague insisted.
The rest are the most important tests: they test behavior, not types.
Do not assert a dynamic language means testing types, it's just not true. Bad testers test types.
- the_af 10y ago"isInstance" doesn't cover the full range of type errors. It simply covers whether something is, say, an Int or a String. Types can encode much more. They can encode behavior.