-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
bpo-25652: Fix __rmod__ of UserString #13326
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
|
As the person who originally filed the bpo issue, I stand by my statement that it's better to fix the bug rather than just remove the method. As demonstrated by my Therefore |
|
@rhettinger whats your thought? I agree with @jcgoble3 |
|
Yeah, let's fix the bug and add a test. |
|
Fixed and tested. |
Lib/test/test_collections.py
Outdated
| arg = UserString("python") | ||
| template = "I love %s" | ||
| self.assertEqual(arg.__rmod__(template), "I love python") | ||
| self.assertIs(arg.__rmod__(type('Dummy', (), {})), NotImplemented) |
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.
It would be more convincing if the test reproduced the end-to-end example from the bpo issue (https://bugs.python.org/file46854/userstringerror.py).
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.
Okey, done.
gvanrossum
left a comment
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.
OK, there's one whitespace nit in the new test left.
Lib/test/test_collections.py
Outdated
| def test_str_rmod(self): | ||
| class ustr2(UserString): | ||
| pass | ||
|
|
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.
Drop the extra blank line please.
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.
Ah, sorry for that. Fixed
|
Do the new tests belong in |
|
I wasn't aware of these tests. Should i move the test? |
|
I'm still new to the contributing process, so I will let the core devs figure out where they belong. I honestly don't know, hence why I asked it as a neutral question. |
|
Looks like the tests in |
|
I moved the test. |
gvanrossum
left a comment
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.
OK, if the test pass it will be merged. Thanks!
|
Thank you for reviewing it. |
|
@isidentical: Status check is done, and it's a success ✅ . |
The
__rmod__method ofcollections.UserStringclass had a bug that made it unusable.https://bugs.python.org/issue25652