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 uranusjr
Recipients uranusjr
Date 2015-10-04.18:07:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
>>> from unittest import mock
>>> class Foo:
...     def __init__(self, val):
...         pass
...     def func(self):
...         pass
>>> class FooMock(mock.Mock):
...     def _get_child_mock(self, **kwargs):
...         return mock.Mock(spec_set=Foo)
>>> mock_foo = FooMock()
>>> mock_foo.func()
<Mock name='mock()' id='4340652632'>
>>> mock_foo.func.mock_calls
>>> mock_foo.func.assert_has_calls([])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.5/unittest/", line 824, in assert_has_calls
    ) from cause
AssertionError: Calls not found.
Expected: [call()]
Actual: [call()]

While this code is expected to fail (FooMock.func is set to an incorrect spec), the error message is misleading and does not make any sense.
Date User Action Args
2015-10-04 18:07:08uranusjrsetrecipients: + uranusjr
2015-10-04 18:07:08uranusjrsetmessageid: <>
2015-10-04 18:07:08uranusjrlinkissue25312 messages
2015-10-04 18:07:08uranusjrcreate