[issue25347] assert_has_calls output is formatted inconsistently

Senthil Kumaran report at bugs.python.org
Tue Jan 12 09:20:04 EST 2016


Senthil Kumaran added the comment:

Verified the change and committed.

The new output behavior will be like this.

```
>>> from unittest.mock import Mock
>>> mock = Mock(return_value=None)
>>> for i in range(1, 10):
...     mock(i)
...
>>> from unittest.mock import call
>>> calls = [call(i) for i in range(2, 10)]
>>> mock.assert_has_calls(calls)
>>> calls.append(call(100))
>>> mock.assert_has_calls(calls)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/senthilkumaran/python/cpython/Lib/unittest/mock.py", line 824, in assert_has_calls
    ) from cause
AssertionError: Calls not found.
Expected: [call(2),
 call(3),
 call(4),
 call(5),
 call(6),
 call(7),
 call(8),
 call(9),
 call(100)]
Actual: [call(1),
 call(2),
 call(3),
 call(4),
 call(5),
 call(6),
 call(7),
 call(8),
 call(9)]
```

----------
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

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


More information about the Python-bugs-list mailing list