[3.11] gh-94808: Cover str.rsplit for UCS1, UCS2 or UCS4 (GH-98228) (#98291)

gh-94808: Cover `str.rsplit` for UCS1, UCS2 or UCS4 (GH-98228)
(cherry picked from commit b7dd2cad18)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
Miss Islington (bot) 2022-10-19 17:53:50 -07:00 committed by GitHub
parent 0b71dad9b8
commit df4aaff0e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View file

@ -469,6 +469,11 @@ def test_split(self):
self.checkraises(ValueError, 'hello', 'split', '', 0)
def test_rsplit(self):
# without arg
self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'rsplit')
self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'rsplit')
self.checkequal([], '', 'rsplit')
# by a char
self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'rsplit', '|')
self.checkequal(['a|b|c', 'd'], 'a|b|c|d', 'rsplit', '|', 1)
@ -522,6 +527,9 @@ def test_rsplit(self):
# with keyword args
self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'rsplit', sep='|')
self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'rsplit', sep=None)
self.checkequal(['a b c', 'd'],
'a b c d', 'rsplit', sep=None, maxsplit=1)
self.checkequal(['a|b|c', 'd'],
'a|b|c|d', 'rsplit', '|', maxsplit=1)
self.checkequal(['a|b|c', 'd'],