This is where a decent static type system helps. The compiler knows if the function is pure or not, and impure functions are more suspect than pure functions.
"Python Unit tests are a poor man's compiler" is a quote that comes to mind.
"Python Unit tests are a poor man's compiler" is a quote that comes to mind.
If your code is pathological it's not your tests' fault.