I try to test some codes which don\'t return anything but save the result to the DB. By mocking the save method, I wish to check whether things have been processed correctly
You need autospec=True
autospec=True
def mock_save(self): assert self.attr == 'dest_val' with mock.patch.object(Item, "save", autospec=True) as save: save.side_effect = mock_save func_to_call()