def test_biconditional(self): expression = "A <=> B" parser = PLParser() root_term = parser.parse(expression) m = Model() m = m.extend("A", True).extend("B", True) self.assertTrue(m.is_true(root_term)) m.clear() m = m.extend("A", True).extend("B", False) self.assertFalse(m.is_true(root_term)) m.clear() m = m.extend("A", False).extend("B", True) self.assertFalse(m.is_true(root_term)) m.clear() m = m.extend("A", False).extend("B", False) self.assertTrue(m.is_true(root_term)) m.clear()
def test_not(self): expression = "NOT A" parser = PLParser() root_term = parser.parse(expression) m = Model() m = m.extend("A", False) self.assertTrue(m.is_true(root_term)) m.clear() m = m.extend("A", True) self.assertFalse(m.is_true(root_term))