3 ms·
Private methods are the internals of your classes. It may change a lot for performance or to make it easy to maintain, one method may become 3 or 4. But people
by arkh 9y ago
Private methods are the internals of your classes. It may change a lot for performance or to make it easy to maintain, one method may become 3 or 4.
But people who use your class don't care. They input something in your public methods and expect something in return. The details of what happen inside should not matter. Adding tests there only help to slow you down and make the dev team resist needed changes. And when you add tests you increase the chances you make them useless or wrong.
- growse 9y agoAh, I think I see. If I break the functionality by changing the implementation of a private class, that should be reflected in the public API unit tests.
- Marazan 9y agoThat's how I see it (in Java at least), unit tests are for guaranteeing that your classes API does what it says it does. In Python I am more loosely goosey about my unit tests and unit tests there are more for helping me write/think about tricky code.