You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Documentation for asserting values of unittest.mock.Mock.call_args_list #91365
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2022-04-04.03:24:22.676>labels= ['3.11', 'type-bug', 'docs']
title='Documentation for asserting values of `unittest.mock.Mock.call_args_list`'updated_at=<Date2022-04-04.05:58:03.586>user='https://github.com/himkt'
Activity
himkt commentedon Apr 4, 2022
Currently documentation says we can check call_args_list by providing a list of tuples of arguments.
(from https://docs.python.org/3.11/library/unittest.mock.html#unittest.mock.Mock.call_args_list)
However, I think we have to wrap all arguments with
call.I'd happy to send a patch if it should be fixed.
### Reproduce:
### Links
himkt commentedon Apr 4, 2022
So sorry, documentation is not wrong.
It only need to wrap an argument when it is a singular value.
But I'm still wondering if we can unify documentation to wrap
call(e.g. https://github.com/himkt/cpython/blob/main/Doc/library/unittest.mock-examples.rst#checking-multiple-calls-with-mock does it).himkt commentedon Apr 4, 2022
It is also wrong..., sorry.
To compare a single value, I should have passed a tuple of tuples.
tirkarthi commentedon May 21, 2022
Just to add call objects themselves are tuples. The docstring of
_Callhas similar examplescpython/Lib/unittest/mock.py
Lines 2418 to 2436 in 2fadde7
slateny commentedon Sep 9, 2022
@himkt Do you still think the docs need clarification or are fine as-is?
himkt commentedon Sep 9, 2022
Sorry, I just noticed the thread is tracked here. Yeah I think the docs are fine as-is. Thank you for pinning.