bpo-25652: Fix __rmod__ of UserString#13326
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.
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).
gvanrossum
left a comment
There was a problem hiding this comment.
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.
Drop the extra blank line please.
There was a problem hiding this comment.
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.
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