-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
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
Conversation
Doc/library/unittest.rst
Outdated
@@ -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 |
There was a problem hiding this comment.
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.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, fixed.
2ca6ddd
to
b6e431b
Compare
There was a problem hiding this 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.
@jstasiak Can I please get a skip news label? |
There was a problem hiding this 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.
Thanks @cool-RR for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8, 3.9. |
Removing 'evaluate' makes it more consistent with other assertX entries. (cherry picked from commit bd8c22e) Co-authored-by: Ram Rachum <ram@rachum.com>
GH-23456 is a backport of this pull request to the 3.9 branch. |
Removing 'evaluate' makes it more consistent with other assertX entries. (cherry picked from commit bd8c22e) Co-authored-by: Ram Rachum <ram@rachum.com>
GH-23457 is a backport of this pull request to the 3.8 branch. |
Removing 'evaluate' makes it more consistent with other assertX entries.
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