[New-bugs-announce] [issue26752] Mock(2.0.0).assert_has_calls() raise AssertionError in two same calls

James report at bugs.python.org
Thu Apr 14 03:43:24 EDT 2016


New submission from James:

>>> import mock
>>> print mock.__version__
2.0.0
>>> 

=================
test.py
from mock import Mock,call

class BB(object):
    def __init__(self):pass
    def print_b(self):pass
    def print_bb(self,tsk_id):pass


bMock = Mock(return_value=Mock(spec=BB))
bMock().print_bb(20)
bMock().assert_has_calls([call.print_bb(20)])


===================
Traceback (most recent call last):
  File "test.py", line 11, in <module>
    bMock().assert_has_calls([call.print_bb(20)])
  File "/usr/lib/python2.7/site-packages/mock/mock.py", line 969, in assert_has_calls
    ), cause)
  File "/usr/lib/python2.7/site-packages/six.py", line 718, in raise_from
    raise value
AssertionError: Calls not found.
Expected: [call.print_bb(20)]
Actual: [call.print_bb(20)]

=======
print expected in mock.py assert_has_calls()

result is:
[TypeError('too many positional arguments',)]

----------
files: test.py
messages: 263375
nosy: jekin000, rbcollins
priority: normal
severity: normal
status: open
title: Mock(2.0.0).assert_has_calls() raise AssertionError in two same calls
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file42460/test.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26752>
_______________________________________


More information about the New-bugs-announce mailing list