aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/string_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/string_tests.py')
-rw-r--r--Lib/test/string_tests.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py
index e998146c190..709cac7a27a 100644
--- a/Lib/test/string_tests.py
+++ b/Lib/test/string_tests.py
@@ -505,6 +505,11 @@ class BaseTest:
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)
@@ -558,6 +563,9 @@ class BaseTest:
# 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'],