From f325de3a76cd56b7fab4efcd7ac6fb9cd5b87628 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Mon, 22 Sep 2003 13:04:15 +0000 Subject: [PATCH] Thought of a bug, wrote a test, discovered it was a bug, fixed it. --- src/fix.py | 2 ++ test/test_fix.py | 1 + 2 files changed, 3 insertions(+) diff --git a/src/fix.py b/src/fix.py index 229049aa9..52e4f581d 100644 --- a/src/fix.py +++ b/src/fix.py @@ -127,6 +127,8 @@ def all(p, seq): return True def rsplit(s, sep=None, maxsplit=-1): + if sep is not None: + sep = sep[::-1] L = s[::-1].split(sep, maxsplit) L.reverse() return [s[::-1] for s in L] diff --git a/test/test_fix.py b/test/test_fix.py index 92fcb3e7f..e65a349ea 100644 --- a/test/test_fix.py +++ b/test/test_fix.py @@ -94,6 +94,7 @@ class FunctionsTest(unittest.TestCase): ['foo bar', 'baz']) self.assertEqual(rsplit('foo bar baz', maxsplit=1), ['foo bar', 'baz']) + self.assertEqual(rsplit('foobarbaz', 'bar'), ['foo', 'baz']) # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: