New submission from Dmitriy Mironiyk <dmitriy.miron...@thras.io>:

I think that behavior of Mock.assert_has_calls is misleading. 
- When I call Mock.assert_has_calls with any_order=False it checks that 
expected calls are the same calls as performed on mock and raise an error if 
mock has some calls other than expected.
- When I call Mock.assert_has_calls with any_order=True it checks that mock has 
expected calls and not raise an error when mock has other calls than expected.

I suppose should be two separate methods:
- Mock.assert_has_only_calls that always raise an error when mock has calls 
other than expected(not regarding any_order).
- Mock.assert_has_calls that raise error only when no calls that provided in 
expected or if order of calls is wrong when any_order=False.

----------
components: Tests
files: test_mock_asser_has_calls.py
messages: 387932
nosy: dmitriy.mironiyk
priority: normal
severity: normal
status: open
title: Mock.assert_has_calls works strange
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file49845/test_mock_asser_has_calls.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43371>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to