def test_join_split_parser(self): """join_split_parser: should return expected""" f = join_split_parser assertEqual = self.assertEqual assertEqual(f(["aa; bb;", "cc."]), ["aa", "bb", "cc"]) assertEqual(f(["aa; bb, bbb;", "cc."], delimiters=";,"), ["aa", ["bb", "bbb"], "cc"]) # test item_modifer got = f("aa (bb) (cc).", "(", item_modifier=rstrip_(") ")) assertEqual(got, ["aa", "bb", "cc"]) assertEqual( f("aa (bb)xx (cc).", "(", item_modifier=rstrip_(") ")), ["aa", "bb)xx", "cc"], ) # test empty assertEqual(f([]), [""]) assertEqual(f(["", " "]), [""]) assertEqual(f(""), [""])
def test_rstrip_(self): """rstrip_ should generate the expected function""" test = " aaa; " self.assertEqual(rstrip_("; ")(test), test.rstrip("; ")) # test default self.assertEqual(rstrip_()(test), test.rstrip())