Here’s a function:
def get_foo(): return None
Simple, right? I don’t need to unit test that. Except I did, because that method was part of a mixin:
class MyMixin(object): def get_foo(): return None
And that mixin was attached to a class, which inherited from another class. And that parent class also inherited from a different mixin, that had a different implementation of get_foo()
. So, if I had actually written the unit test against the class in question, I would’ve caught that error right away.
At least I had the sense to write the unit test when I was trying to figure out why things were failing in the functional testing.
Write the unit test. Just write it.