模拟python类方法

模拟python类方法,python,mocking,python-mock,Python,Mocking,Python Mock,我一直在尝试模拟一个类方法,但到目前为止我还没有成功,也找不到合适的文档,你们中有谁能告诉我如何为下面的代码编写模拟测试 1.py: 2.py: 这是无效的Python语法。我不熟悉Python和Mock,因此会出错。但我的想法是模拟一个实例方法。我想你们必须先修复你们的Python。这是无效的Python语法。我对Python和mock都是新手,所以会出错。但这个想法是模拟一个实例方法,我想您必须首先修复Python。 class abc: def classmethod:

我一直在尝试模拟一个类方法,但到目前为止我还没有成功,也找不到合适的文档,你们中有谁能告诉我如何为下面的代码编写模拟测试

1.py: 2.py:
这是无效的Python语法。我不熟悉Python和Mock,因此会出错。但我的想法是模拟一个实例方法。我想你们必须先修复你们的Python。这是无效的Python语法。我对Python和mock都是新手,所以会出错。但这个想法是模拟一个实例方法,我想您必须首先修复Python。
class abc:
    def classmethod:
        return "message from class methos"
from one.py import abc
client = abc()

def function:
    res = abc.classmethos()  # how to mock so abc.classmethod() returns "hello" instead of "message from class method"
    return res