10000 bpo-42391: Clarify documentation of TestCase.assertIs by cool-RR · Pull Request #23348 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-42391: Clarify documentation of TestCase.assertIs #23348

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

Merged
merged 1 commit into from
Nov 22, 2020

Conversation

cool-RR
Copy link
Contributor
@cool-RR cool-RR commented Nov 17, 2020

I believe the current phrasing with "evaluate to the same object" might be seen by some as first == second which is not the case.

Can I please get labels for skipping news and maybe backporting?

https://bugs.python.org/issue42391

@@ -897,7 +897,7 @@ Test cases
.. method:: assertIs(first, second, msg=None)
assertIsNot(first, second, msg=None)

Test that *first* and *second* evaluate (or don't evaluate) to the
Test that *first* and *second* are (or are not) references to the exact
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that the word "exact" adds any value in the proposed new wording. Why not simply:

Test that first and second are (or are not) the same object.

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, fixed.

@cool-RR cool-RR force-pushed the 2020-11-17-unittest-docs branch from 2ca6ddd to b6e431b Compare November 18, 2020 18:38
Copy link
Contributor
@jstasiak jstasiak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I don't really see how the current wording points in the direction of first == second I like the new one better.

@cool-RR
Copy link
Contributor Author
cool-RR commented Nov 19, 2020

@jstasiak Can I please get a skip news label?

Copy link
Member
@terryjreedy terryjreedy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see a lawyerly justification for 'evaluate': first and second are not objects, but expressions that evaluate to objects. But the same applies to other assertX methods, in particular assertEqual, whose entry is "Test that first and second are equal." Ditto for `assertNotEqual. 'Evaluate' is also missing from all other entries in the 'common' group, so the change makes this entry consistent.

@terryjreedy terryjreedy merged commit bd8c22e into python:master Nov 22, 2020
@miss-islington
Copy link
Contributor

Thanks @cool-RR for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8, 3.9.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 22, 2020
Removing 'evaluate' makes it more consistent with other assertX entries.
(cherry picked from commit bd8c22e)

Co-authored-by: Ram Rachum <ram@rachum.com>
@bedevere-bot
Copy link

GH-23456 is a backport of this pull request to the 3.9 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Nov 22, 2020
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 22, 2020
Removing 'evaluate' makes it more consistent with other assertX entries.
(cherry picked from commit bd8c22e)

Co-authored-by: Ram Rachum <ram@rachum.com>
@bedevere-bot
Copy link

GH-23457 is a backport of this pull request to the 3.8 branch.

miss-islington added a commit that referenced this pull request Nov 22, 2020
Removing 'evaluate' makes it more consistent with other assertX entries.
(cherry picked from commit bd8c22e)

Co-authored-by: Ram Rachum <ram@rachum.com>
miss-islington added a commit that referenced this pull request Nov 22, 2020
Removing 'evaluate' makes it more consistent with other assertX entries.
(cherry picked from commit bd8c22e)

Co-authored-by: Ram Rachum <ram@rachum.com>
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
Removing 'evaluate' makes it more consistent with other assertX entries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants
0