def test_default_rule(self): rd = Atom(AlwaysTrue(), ToStr()) self.assertEquals((True, '1'), rd.apply(1)) self.assertEquals((True, '3'), rd.apply(3))
def test_atom_rule_1_3(self): r1_3 = Atom(Times(3), ToFizz()) self.assertEquals((True, 'Fizz'), r1_3.apply(3)) self.assertEquals((False, ''), r1_3.apply(4))
def test_rule_3(self): r3 = Atom(Contains(3), ToFizz()) self.assertEquals((True, 'Fizz'), r3.apply(3)) self.assertEquals((True, 'Fizz'), r3.apply(13)) self.assertEquals((True, 'Fizz'), r3.apply(31)) self.assertEquals((False, ''), r3.apply(24))
def test_atom_rule_1_7(self): r1_7 = Atom(Times(7), ToWhizz()) self.assertEquals((True, 'Whizz'), r1_7.apply(14)) self.assertEquals((False, ''), r1_7.apply(13))
def test_atom_rule_1_5(self): r1_5 = Atom(Times(5), ToBuzz()) self.assertEquals((True, 'Buzz'), r1_5.apply(10)) self.assertEquals((False, ''), r1_5.apply(11))
def test_atom_rule_1_8(self): r1_8 = Atom(Times(8), ToHazz()) self.assertEquals((True, 'Hazz'), r1_8.apply(16)) self.assertEquals((False, ''), r1_8.apply(13))