def check_instance(self, actual_code, correct_code, msg=None): """Checks if ACTUAL_CODE is an instance of CORRECT_CODE.""" return self.check_equal( actual_code, correct_code, msg=msg, equal=lambda x, y: unify.instance(x, y) is not None)
def test_instance(self): """Test whether the INSTANCE computation is correct.""" def assertIsNotNone(x): self.assertTrue(x is not None) def assertIsNone(x): self.assertTrue(x is None) assertIsNotNone(unify.instance(str2form('p(1)'), str2form('p(y)'))) assertIsNotNone(unify.instance(str2form('p(1,2)'), str2form('p(x,y)'))) assertIsNotNone(unify.instance(str2form('p(1,x)'), str2form('p(x,y)'))) assertIsNotNone(unify.instance(str2form('p(1,x,1)'), str2form('p(x,y,x)'))) assertIsNotNone(unify.instance(str2form('p(1,x,1)'), str2form('p(x,y,z)'))) assertIsNone(unify.instance(str2form('p(1,2)'), str2form('p(x,x)')))
def test_instance(self): """Test whether the INSTANCE computation is correct.""" def assertIsNotNone(x): self.assertTrue(x is not None) def assertIsNone(x): self.assertTrue(x is None) assertIsNotNone(unify.instance(str2form('p(1)'), str2form('p(y)'))) assertIsNotNone(unify.instance(str2form('p(1,2)'), str2form('p(x,y)'))) assertIsNotNone(unify.instance(str2form('p(1,x)'), str2form('p(x,y)'))) assertIsNotNone( unify.instance(str2form('p(1,x,1)'), str2form('p(x,y,x)'))) assertIsNotNone( unify.instance(str2form('p(1,x,1)'), str2form('p(x,y,z)'))) assertIsNone(unify.instance(str2form('p(1,2)'), str2form('p(x,x)')))