Python unittest.mock模块,常用函数和类

下面列出了Python unittest.mock 模块中定义的常用函数和类,我们从989个开源Python项目中,按照使用频率进行了排序。

函数和类 使用项目数
1. patch() 用在(631)个项目中
2. MagicMock() 用在(434)个项目中
3. Mock() 用在(402)个项目中
4. call() 用在(136)个项目中
5. ANY 用在(56)个项目中
6. mock_open() 用在(48)个项目中
7. PropertyMock() 用在(44)个项目中
8. create_autospec() 用在(20)个项目中
9. DEFAULT 用在(14)个项目中
10. return_value() 用在(9)个项目中
11. assert_called_once_with() 用在(6)个项目中
12. call_count() 用在(6)个项目中
13. called() 用在(5)个项目中
14. assert_called_with() 用在(5)个项目中
15. sentinel() 用在(5)个项目中
16. assert_has_calls() 用在(5)个项目中
17. side_effect() 用在(5)个项目中