testableclass that we used, among other things, to demonstrate how it can be difficult to separate methods so we can deal with them as units? Although we saw this before in Chapter 3, here it is again:
class testable: def method1(self, number): number += 4 number **= 0.5 number *= 7 return number def method2(self, number): return ((number * 2) ** 1.27) * 0.3 def method3(self, number): return self.method1(number) + self.method2(number) def method4(self): return self.method3(id(self))
method3. Like all unit tests, it needs to not involve any code from any other unit, which in this case means that
self.method2need to be mock objects. ...