def test_creation(self): self.title = FilterValue("title", ".*men$", True) self.assertEquals(str(self.title), "title") self.assertEquals(self.title.activated, True) self.assertEquals(self.title.does_match("Good Omens"), False) self.assertEquals(self.title.does_match("men").get_match(), "men") self.assertEquals(self.title.does_match("women").get_match(), "women")
def setUp(self): self.title = FilterValue("title", ".*men$", True)
class ValueTest(unittest.TestCase): def setUp(self): self.title = FilterValue("title", ".*men$", True) def test_creation(self): self.title = FilterValue("title", ".*men$", True) self.assertEquals(str(self.title), "title") self.assertEquals(self.title.activated, True) self.assertEquals(self.title.does_match("Good Omens"), False) self.assertEquals(self.title.does_match("men").get_match(), "men") self.assertEquals(self.title.does_match("women").get_match(), "women") def test_setters(self): self.title.set_value(".*men.?") self.assertEquals(self.title.does_match("Good Omens").get_match(), "Good Omens") self.assertEquals(self.title.does_match("women").get_match(), "women") self.title.activated = False self.assertEquals(self.title.does_match("Good Omens"), False) self.assertEquals(self.title.does_match("women"), False) def test_blank(self): self.title.set_value("") self.assertEquals(self.title.activated, True) self.assertEquals(self.title.does_match("Good Omens"), False) self.assertEquals(self.title.does_match("men"), False) self.assertEquals(self.title.does_match("women"), False)