classification
Title: Sort keyword arguments in mock _format_call_signature
Type: behavior Stage: resolved
Components: Versions: Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: michael.foord Nosy List: eric.snow, kushal.das, michael.foord, python-dev
Priority: normal Keywords: easy, patch

Created on 2014-04-16 16:37 by michael.foord, last changed 2014-06-09 08:16 by python-dev. This issue is now closed.

Files
File name Uploaded Description Edit
issue21256.patch kushal.das, 2014-04-16 17:04 Patch uploaded for the same. review
issue21256_v2.patch kushal.das, 2014-04-22 03:30 New patch with test and news entry. review
Messages (8)
msg216491 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2014-04-16 16:37
Printing call args produces non-deterministic results, making them more or less useless in doctests.

kwargs_string = ', '.join([
        '%s=%r' % (key, value) for key, value in kwargs.items()
    ])

should be:

kwargs_string = ', '.join([
        '%s=%r' % (key, value) for key, value in sorted(kwargs.items())
    ])
msg216501 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2014-04-16 16:57
Ordered kwargs anyone? :)
msg216504 - (view) Author: Kushal Das (kushal.das) * (Python committer) Date: 2014-04-16 17:04
Patch uploaded for the same.
msg216512 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2014-04-16 17:42
Yes to ordered kwargs! I would very much like to be able to order the keyword args in the order they were passed in, information which is currently lost.
msg216537 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2014-04-16 18:11
Needs a test.
msg216981 - (view) Author: Kushal Das (kushal.das) * (Python committer) Date: 2014-04-22 03:30
New patch with test and news entry.
msg216998 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2014-04-22 10:53
I agree with Antoine's review comments. With those changes in place, ok to commit.
msg220085 - (view) Author: Roundup Robot (python-dev) Date: 2014-06-09 08:16
New changeset 8e05e15901a8 by Kushal Das in branch 'default':
Closes #21256: Printout of keyword args in deterministic order in mock calls.
http://hg.python.org/cpython/rev/8e05e15901a8
History
Date User Action Args
2014-06-09 08:16:18python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg220085

resolution: fixed
stage: needs patch -> resolved
2014-04-22 10:53:17michael.foordsetmessages: + msg216998
2014-04-22 03:30:20kushal.dassetfiles: + issue21256_v2.patch

messages: + msg216981
2014-04-16 18:11:54michael.foordsetmessages: + msg216537
2014-04-16 17:42:32michael.foordsetmessages: + msg216512
2014-04-16 17:04:23kushal.dassetfiles: + issue21256.patch
keywords: + patch
messages: + msg216504
2014-04-16 16:57:30eric.snowsetnosy: + eric.snow
messages: + msg216501
2014-04-16 16:37:06michael.foordcreate