Message302677
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):
pass
def foo(self):
self.foobar()
def bar(self):
Something.foobar() # this is broken
from unittest import mock
x = mock.Mock(spec=Something)
x.foo()
x.foo.assert_called_with()
x.bar()
x.bar.assert_called_with() # this assertion pass!
# real code
z = Something()
z.foo()
z.bar() # raise exception |
|
Date |
User |
Action |
Args |
2017-09-21 09:35:48 | jonathan.huot | set | recipients:
+ jonathan.huot |
2017-09-21 09:35:48 | jonathan.huot | set | messageid: <1505986548.45.0.223796234627.issue31541@psf.upfronthosting.co.za> |
2017-09-21 09:35:48 | jonathan.huot | link | issue31541 messages |
2017-09-21 09:35:48 | jonathan.huot | create | |
|