Skip to content

Parameter order in assertEqual() statements #440

Closed

Description

@behrtam

We have both ways of ordering the parameters actual, expected result of the assertEqual() method.

While the Python implementation uses indifferent names (first, second - code) all examples use the order actual followed by expected (python doc – basic-example).

self.assertEqual('foo'.upper(), 'FOO')
self.assertEqual(s.split(), ['hello', 'world'])

I think it would be better to be consistent within this track. As I personally don't have any preferences I would just follow the official python documentation examples and default to self.assertEqual(actual, expected).

@rootulp @pheanex do you have any opinions about this?

Activity

  1. pheanex commented on Mar 22, 2017

    @pheanex
    Contributor

    (actual, expected) looks good to me. I am in favour of consistency.

  2. rootulp commented on Mar 22, 2017

    @rootulp
    Contributor

    I think conforming to the Python doc basic example is a god idea. (Actual, expected) seems right.

  3. added 2 commits that reference this issue on Mar 23, 2017
    9ef416b
    b80622a
  4. added a commit that references this issue on Mar 23, 2017
    bbd3c62
  5. nikclayton commented on Feb 20, 2019

    @nikclayton

    FYI -- if you run the tests in PyCharm (as I'm doing with my students) PyCharm shows the Expected/Actual results in the wrong order. The JetBrains bug for this behaviour is https://youtrack.jetbrains.com/issue/PY-27267.

  6. cmccandless commented on Feb 20, 2019

    @cmccandless
    Contributor

    @nikclayton thank you for adding that info here.

    We've run into that issue before here, but it's good to document it as a known issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions