diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/string_tests.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py index e242170..489af20 100644 --- a/Lib/test/string_tests.py +++ b/Lib/test/string_tests.py @@ -999,8 +999,8 @@ class MixinStrUnicodeUserStringTest: def test_partition(self): - self.checkequal(('this', ' is ', 'the partition method'), - 'this is the partition method', 'partition', ' is ') + self.checkequal(('this is the par', 'ti', 'tion method'), + 'this is the partition method', 'partition', 'ti') # from raymond's original specification S = 'http://www.python.org' @@ -1012,6 +1012,21 @@ class MixinStrUnicodeUserStringTest: self.checkraises(ValueError, S, 'partition', '') self.checkraises(TypeError, S, 'partition', None) + def test_rpartition(self): + + self.checkequal(('this is the rparti', 'ti', 'on method'), + 'this is the rpartition method', 'rpartition', 'ti') + + # from raymond's original specification + S = 'http://www.python.org' + self.checkequal(('http', '://', 'www.python.org'), S, 'rpartition', '://') + self.checkequal(('http://www.python.org', '', ''), S, 'rpartition', '?') + self.checkequal(('', 'http://', 'www.python.org'), S, 'rpartition', 'http://') + self.checkequal(('http://www.python.', 'org', ''), S, 'rpartition', 'org') + + self.checkraises(ValueError, S, 'rpartition', '') + self.checkraises(TypeError, S, 'rpartition', None) + class MixinStrStringUserStringTest: # Additional tests for 8bit strings, i.e. str, UserString and |