1# This program is free software; you can redistribute it and/or modify 2# it under the terms of the GNU General Public License as published by 3# the Free Software Foundation; either version 2 of the License, or 4# (at your option) any later version. 5 6from tests import TestCase 7 8from quodlibet.qltk.tagsfrompath import (TitleCase, SplitTag, 9 UnderscoresToSpaces) 10import quodlibet.config 11 12 13class FilterTestCase(TestCase): 14 def setUp(self): 15 quodlibet.config.init() 16 self.c = self.Kind() 17 18 def tearDown(self): 19 self.c.destroy() 20 quodlibet.config.quit() 21 22 23class TTitleCase(FilterTestCase): 24 Kind = TitleCase 25 26 def test_simple(self): 27 self.failUnlessEqual(self.c.filter("title", "foo bar"), "Foo Bar") 28 29 def test_apostrophe(self): 30 self.failUnlessEqual(self.c.filter("title", "IT's"), "IT's") 31 32 33class TSplitTag(FilterTestCase): 34 Kind = SplitTag 35 36 def test_simple(self): 37 self.failUnlessEqual(self.c.filter("title", "foo & bar"), "foo\nbar") 38 39 40class TUnderscoresToSpaces(FilterTestCase): 41 Kind = UnderscoresToSpaces 42 43 def test_simple(self): 44 self.failUnlessEqual(self.c.filter("titke", "foo_bar"), "foo bar") 45