diff options
| author | Batuhan Taşkaya <47358913+isidentical@users.noreply.github.com> | 2019-05-21 20:27:36 (GMT) |
|---|---|---|
| committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-05-21 20:27:36 (GMT) |
| commit | 7abf8c60819d5749e6225b371df51a9c5f1ea8e9 (patch) | |
| tree | f8051a2d600e0faeb7e025e031c26a4287b7e5ef /Lib/test/test_userstring.py | |
| parent | 565b4f1ac7304d1e690c404ca8316f383ba60862 (diff) | |
| download | cpython-7abf8c60819d5749e6225b371df51a9c5f1ea8e9.zip cpython-7abf8c60819d5749e6225b371df51a9c5f1ea8e9.tar.gz cpython-7abf8c60819d5749e6225b371df51a9c5f1ea8e9.tar.bz2 | |
bpo-25652: Fix __rmod__ of UserString (GH-13326)
The ``__rmod__`` method of ``collections.UserString`` class had a bug that made it unusable.
https://bugs.python.org/issue25652
Diffstat (limited to 'Lib/test/test_userstring.py')
| -rw-r--r-- | Lib/test/test_userstring.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_userstring.py b/Lib/test/test_userstring.py index 7152822..19b0acf 100644 --- a/Lib/test/test_userstring.py +++ b/Lib/test/test_userstring.py @@ -39,6 +39,18 @@ class UserStringTest( # we don't fix the arguments, because UserString can't cope with it getattr(object, methodname)(*args) + def test_rmod(self): + class ustr2(UserString): + pass + + class ustr3(ustr2): + def __rmod__(self, other): + return super().__rmod__(other) + + fmt2 = ustr2('value is %s') + str3 = ustr3('TEST') + self.assertEqual(fmt2 % str3, 'value is TEST') + if __name__ == "__main__": unittest.main() |
