我有:
folder / cats.py
class Cat(object):
def __init__(self,color):
self.color = color
def meow():
pass
folder / something.py
def something():
from folder.cats import Cat
scootish_fold = Cat(color='Black')
scootish_fold.meow()
如何修补meow()
?
我尝试过:
@patch('folder.something.Cat.meow')
def test_meow(self,cat_meow_patch):
cat_patch.return_value = 'MEOWW!'
但是我不断收到AttributeError
。