def test_addition(self): rules1 = rules( (gt(0), 'positive'), (lt(0), 'negative'), ) rules2 = rules((eq(0), 'zero'), ) these_rules = rules1 + rules2 self.assertEqual(len(these_rules), 3) self.assertEqual(decide(these_rules, 0), 'zero')
def test_addition(self): rules1 = rules( (gt(0), 'positive'), (lt(0), 'negative'), ) rules2 = rules( (eq(0), 'zero'), ) these_rules = rules1 + rules2 self.assertEqual(len(these_rules), 3) self.assertEqual(decide(these_rules, 0), 'zero')
def setUp(self): self.positivity_rules = rules( (gt(0), 'positive'), (lt(0), 'negative'), ) self.type_rules = rules( (is_number, rules( (gt(0), 'positive number'), (eq(0), 'zero'), (lt(0), 'negative number'), )), (is_string, 'string'), (otherwise, 'unhandled type'), )
def test_len(self): these_rules = rules( (gt(0), 'positive'), (lt(0), 'negative'), ) self.assertEqual(len(these_rules), 2)