mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
[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:
parent
0b71dad9b8
commit
df4aaff0e6
2 changed files with 14 additions and 2 deletions
|
|
@ -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'],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue