Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort keyword arguments in mock _format_call_signature #65455

Closed
voidspace opened this issue Apr 16, 2014 · 8 comments
Closed

Sort keyword arguments in mock _format_call_signature #65455

voidspace opened this issue Apr 16, 2014 · 8 comments
Assignees
Labels
easy type-bug An unexpected behavior, bug, or error

Comments

@voidspace
Copy link
Contributor

BPO 21256
Nosy @voidspace, @ericsnowcurrently, @kushaldas
Files
  • issue21256.patch: Patch uploaded for the same.
  • issue21256_v2.patch: New patch with test and news entry.
  • 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 = 'https://github.com/voidspace'
    closed_at = <Date 2014-06-09.08:16:18.372>
    created_at = <Date 2014-04-16.16:37:06.144>
    labels = ['easy', 'type-bug']
    title = 'Sort keyword arguments in mock _format_call_signature'
    updated_at = <Date 2014-06-09.08:16:18.371>
    user = 'https://github.com/voidspace'

    bugs.python.org fields:

    activity = <Date 2014-06-09.08:16:18.371>
    actor = 'python-dev'
    assignee = 'michael.foord'
    closed = True
    closed_date = <Date 2014-06-09.08:16:18.372>
    closer = 'python-dev'
    components = []
    creation = <Date 2014-04-16.16:37:06.144>
    creator = 'michael.foord'
    dependencies = []
    files = ['34914', '34998']
    hgrepos = []
    issue_num = 21256
    keywords = ['patch', 'easy']
    message_count = 8.0
    messages = ['216491', '216501', '216504', '216512', '216537', '216981', '216998', '220085']
    nosy_count = 4.0
    nosy_names = ['michael.foord', 'python-dev', 'eric.snow', 'kushal.das']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue21256'
    versions = ['Python 3.5']

    @voidspace
    Copy link
    Contributor Author

    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())
    ])

    @voidspace voidspace self-assigned this Apr 16, 2014
    @voidspace voidspace added easy type-bug An unexpected behavior, bug, or error labels Apr 16, 2014
    @ericsnowcurrently
    Copy link
    Member

    Ordered kwargs anyone? :)

    @kushaldas
    Copy link
    Member

    Patch uploaded for the same.

    @voidspace
    Copy link
    Contributor Author

    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.

    @voidspace
    Copy link
    Contributor Author

    Needs a test.

    @kushaldas
    Copy link
    Member

    New patch with test and news entry.

    @voidspace
    Copy link
    Contributor Author

    I agree with Antoine's review comments. With those changes in place, ok to commit.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jun 9, 2014

    New changeset 8e05e15901a8 by Kushal Das in branch 'default':
    Closes bpo-21256: Printout of keyword args in deterministic order in mock calls.
    http://hg.python.org/cpython/rev/8e05e15901a8

    @python-dev python-dev mannequin closed this as completed Jun 9, 2014
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    easy type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants