[issue31541] Mock called_with does not ensure self/cls argument is used

Karthikeyan Singaravelan report at bugs.python.org
Mon Nov 12 02:05:32 EST 2018


Karthikeyan Singaravelan <tir.karthi at gmail.com> added the comment:

mock can only verify if the function is called with the correct number of arguments as you have passed spec. It doesn't verify whether the function implementation is correct like calling Something.foobar() because it's not designed to verify the function implementation. It wouldn't raise an exception even when self.foo(1, 2) is called inside x.bar because runtime code is not executed and only the signature is checked with mock. I think this is an expected behavior and not a bug.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31541>
_______________________________________


More information about the Python-bugs-list mailing list