所以我有以下名为 test_target1.py 的测试目标代码
from anotherfunc import ano_func1
def first_func():
print("first_func")
def last_func():
ano_func1(5)
ano_func1(15)
test_target1.last_func() 从另一个 python 文件调用另一个方法。另一个函数.py
def ano_func1(param1):
print("ano_func1" + str(param1))
并且测试该目标代码的代码只是在 test_target1.py 中调用 last_func()
from test_target1 import last_func
last_func()
我想做的是制作两个完全相同的函数,test_target1.last_func 中的 ano_func1 调用不同的函数,例如 mocked1_func1、mocked2_func2。有没有办法做到这一点?