def testSubstApply(self): """ Check application of substitutions """ self.assertEqual(terms.term2String(self.sigma1(self.t1)), "f(a,g(a))") self.assertTrue(terms.termEqual(self.sigma1(self.t1), self.t4)) self.assertTrue(terms.termEqual(self.sigma2(self.t1), self.t5))
def testSubstBasic(self): """ Test basic stuff. """ tau = self.sigma1.copy() self.assertTrue(terms.termEqual(tau("X"), self.sigma1("X"))) self.assertTrue(terms.termEqual(tau("Y"), self.sigma1("Y"))) self.assertTrue(terms.termEqual(tau("Z"), self.sigma1("Z"))) t = tau.modifyBinding(("X", self.t1)) self.assertTrue(terms.termEqual(t, self.t2)) t = tau.modifyBinding(("U", self.t1)) self.assertEqual(t, None) self.assertTrue(tau.isBound("U")) self.assertTrue(terms.termEqual(tau.value("U"), self.t1)) t = tau.modifyBinding(("U", None)) self.assertTrue(not tau.isBound("U"))