def activated(self, tag, value): spls = config.get("editing", "split_on").decode("utf-8", "replace").split() title, versions = util.split_title(value, spls) return [(tag, title)] + [("version", v) for v in versions]
def test_custom_splitter(self): self.failUnlessEqual( util.split_title("foo [b c]", " "), ("foo", ["b", "c"]))
def __init__(self, tag, value): super(SplitTitle, self).__init__(_("Split _Version out of Title")) self.set_image(gtk.image_new_from_stock(gtk.STOCK_FIND_AND_REPLACE, gtk.ICON_SIZE_MENU)) spls = config.get("editing", "split_on").decode("utf-8", "replace").split() self.set_sensitive(bool(util.split_title(value, spls)[1]))
def test_two_versions(self): self.failUnlessEqual( util.split_title("foo [b, c]"), ("foo", ["b", "c"]))
def test_simple(self): self.failUnlessEqual(util.split_title("foo (baz)"), ("foo", ["baz"]))
def test_prefix_and_version(self): self.failUnlessEqual(util.split_title("~foo ~bar~"), ("~foo", ["bar"]))
def test_prefix_and_trailing(self): self.failUnlessEqual(util.split_title("~foo ~"), ("~foo ~", []))
def test_prefixed(self): self.failUnlessEqual(util.split_title("~foo "), ("~foo ", []))