Frage im Vorstellungsgespräch bei Simons Foundation

Why is the difference between unit testing a 100 line function vs unit testing a 500 line function?

Antwort im Vorstellungsgespräch

Anonym

9. Nov. 2016

pylint warnings aside (for any function > 50 lines), it is more work to debug the output of a longer function. The expected answer, however, was that a bigger function should be broken into several smaller functions, each of which can be unit tested instead. IMHO, this is irrelevant because if you're doing unit testing correctly, only public functions are ever to be unit tested, and not private functions.