New submission from Felix Yan:
Since Python 3.5.0 mock.MagicMock() object seems not matched by mock.ANY. This
behavior looks weird and breaks tests of boto.
Minimized example:
In Python 3.4.3:
>>> from unittest import mock
>>> m = mock.MagicMock()
>>> m(mock.MagicMock())
<MagicMock name='mock()' id='139728217270704'>
>>> m.assert_called_with(mock.ANY)
>>>
In Python 3.5.0:
>>> from unittest import mock
>>> m = mock.MagicMock()
>>> m(mock.MagicMock())
<MagicMock name='mock()' id='140093484276536'>
>>> m.assert_called_with(mock.ANY)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.5/unittest/mock.py", line 792, in assert_called_with
raise AssertionError(_error_message()) from cause
AssertionError: Expected call: mock(<ANY>)
Actual call: mock(<MagicMock id='140093520206872'>)
----------
components: Library (Lib)
messages: 251162
nosy: felixonmars
priority: normal
severity: normal
status: open
title: mock.ANY doesn't match mock.MagicMock() object
versions: Python 3.5
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue25195>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com