def test_convert_conjunction(self): call = Compound('call', Variable('X')) term = Compound(',', Variable('X'), call) goal = convert_to_goal(term) self.assertEquals(',/2', goal.predicate_indicator()) self.assertEquals(call, goal.value[1]) self.assertEquals(call, goal.value[2])
def test_convert_disjunction(self): term = Compound(';', Variable('X'), Atomic('p')) goal = convert_to_goal(term) self.assertEquals(';/2', goal.predicate_indicator()) self.assertEquals(Compound('call', Variable('X')), goal.value[1]) self.assertEquals(Atomic('p'), goal.value[2])
def test_convert_call(self): term = Compound('call', Variable('X')) self.assertEquals(term, convert_to_goal(term))
def test_convert_variable(self): term = Variable('X') goal = Compound('call', term) self.assertEquals(goal, convert_to_goal(term))
def test_convert_number(self): term = Atomic(3) self.assertTrue(convert_to_goal(term) is None)
def test_convert_compound(self): term = Compound('f', Variable('X'), Atomic('g')) self.assertEquals(term, convert_to_goal(term))