Closes #21256: Printout of keyword args in deterministic order in mock calls.

Printout of keyword args should be in deterministic order in
a mock function call. This will help to write better doctests.
This commit is contained in:
Kushal Das 2014-06-09 13:45:56 +05:30
parent 85e4235c0e
commit 047f14c3c6
3 changed files with 10 additions and 1 deletions

View file

@ -1894,7 +1894,7 @@ def _format_call_signature(name, args, kwargs):
formatted_args = ''
args_string = ', '.join([repr(arg) for arg in args])
kwargs_string = ', '.join([
'%s=%r' % (key, value) for key, value in kwargs.items()
'%s=%r' % (key, value) for key, value in sorted(kwargs.items())
])
if args_string:
formatted_args = args_string