This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jonathan.huot
Recipients jonathan.huot
Date 2017-09-21.09:35:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Mock "assert_called_with" does not contain a possibility to verify if "self" or "cls" is used when mock is called.

So, in unittests, all tests are passing but code is broken. Example :

Steps to reproduce:

class Something(object):
    def foobar(self):

    def foo(self):

    def bar(self):
        Something.foobar()  # this is broken

from unittest import mock
x = mock.Mock(spec=Something)  # this assertion pass!

# real code 
z = Something()  # raise exception
Date User Action Args
2017-09-21 09:35:48jonathan.huotsetrecipients: + jonathan.huot
2017-09-21 09:35:48jonathan.huotsetmessageid: <>
2017-09-21 09:35:48jonathan.huotlinkissue31541 messages
2017-09-21 09:35:48jonathan.huotcreate