I want to patch a function\'s return value in a unittest (it is originally expensive to evaluate), but still test its side effect (setting an attribute). The code looks sth like