Assert a function/method was not called using Mock

后端 未结 6 1619
深忆病人
深忆病人 2020-12-12 19:50

I\'m using the Mock library to test my application, but I want to assert that some function was not called. Mock docs talk about methods like mock.assert_called_with

6条回答
  •  无人及你
    2020-12-12 20:43

    Though an old question, I would like to add that currently mock library (backport of unittest.mock) supports assert_not_called method.

    Just upgrade yours;

    pip install mock --upgrade

提交回复
热议问题