Given the following simple example:
class MathObject(object):
""" A completely superfluous class. """
def add(self, a, b):
return a + b
def multiply(self, a, b):
result = 0
for _ in range(b):
result = self.add(result, a)
return result
Obviously, multiply() calls add() internally. If add fails, multiply() fails too. In a complex enough class it might be really complex to find out why exactly a unit test failed.
How does one unit test methods/objects/parts that have dependencies?