e1 = slist.pop(0)
if e1.endswith("\\"):
num_b = len(e1) - len(e1.rstrip("\\"))
- if num_b % 2 == 1:
+ if num_b % 2 == 1 and slist:
e2 = slist.pop(0)
# here the backslashes remain (all), and will be reduced in
# the next step
def setUp(self):
# testing more that one separator for regexp safety
- self._seps = [",", "+", "."]
+ self._seps = [",", "+", ".", ":"]
def testSimple(self):
a = ["a", "b", "c", "d"]
b = ["a", "b\\" + sep + "c", "d"]
self.failUnlessEqual(utils.UnescapeAndSplit(sep.join(a), sep=sep), b)
+ def testEscapeAtEnd(self):
+ for sep in self._seps:
+ self.assertEqual(utils.UnescapeAndSplit("\\", sep=sep), ["\\"])
+
+ a = ["a", "b\\", "c"]
+ b = ["a", "b" + sep + "c\\"]
+ self.assertEqual(utils.UnescapeAndSplit("%s\\" % sep.join(a), sep=sep), b)
+
+ a = ["\\" + sep, "\\" + sep, "c", "d\\.moo"]
+ b = [sep, sep, "c", "d.moo\\"]
+ self.assertEqual(utils.UnescapeAndSplit("%s\\" % sep.join(a), sep=sep), b)
+
class TestCommaJoin(unittest.TestCase):
def test(self):