断言对模拟方法的连续调用 - Asserting successive calls to a mock method

10/14 02:32
阅读数 0

问题:

Mock has a helpful assert_called_with() method . Mock 有一个有用的assert_called_with()方法 However, as far as I understand this only checks the last call to a method.但是,据我所知,这只检查对方法的最后一次调用。
If I have code that calls the mocked method 3 times successively, each time with different parameters, how can I assert these 3 calls with their specific parameters?如果我的代码连续 3 次调用模拟方法,每次使用不同的参数,我如何使用它们的特定参数断言这 3 次调用?


解决方案:

参考一: https://en.stackoom.com/question/UO5R
参考二: https://stackoom.com/question/UO5R
展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部