Mock object bug with assert_not_called

Steve D'Aprano steve+python at
Tue Dec 27 20:45:27 EST 2016

On Wed, 28 Dec 2016 07:15 am, Diego Vela wrote:

> Dear all,
>>From reading the documentation it seemed like this is the place to post a
> bug.  If not please let me know where is the proper place to do so.

Once you are sure that it truly is a bug, then the proper place is the bug

This is a good place to ask if you are unsure whether it is or isn't a bug.

> Bug:
> For mock objects created using the @patch decorator the following methods
> are inconsistent.
> assert_not_called,
> assert_called_with
> Steps
> Create a mock object using the @patch decorator for a function.
> call a function that that calls the mocked function.
> check assert_not_called and assert_called with.

Thank you, but this bug report can be improved.

(1) What results do you expect? What results do you get?

(2) What version of Python are you using?

(3) Code is better than English. Can you supply a *minimal* (as small and
simple as possible) example that shows this bug?

“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

More information about the Python-list mailing list