[issue45305] Incorrect record of call_args_list when using multiple side_effect in mock.patch

Andrei Kulakov report at bugs.python.org
Fri Oct 22 17:22:46 EDT 2021


Andrei Kulakov <andrei.avk at gmail.com> added the comment:

Dave: what seems to happen here is that mock correctly reporting to you that the object you passed to the mocked func is currently `{}`. What you probably expected it to be is to be equal to what it was at exact time when it was passed, i.e. before it was modified inside the method.

That's a reasonable expectation but it means it would have to be deepcopied, which could be expensive for large structures.

Do you think that noting this nuance in the docs for call_list_args would have helped you debug it in this case?

----------
nosy: +andrei.avk

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45305>
_______________________________________


More information about the Python-bugs-list mailing list