def test_ne_(self): FpS = FpSemigroup("ab", [["a^10", "a"], ["bbb", "b"], ["ba", "ab"]]) a = "aba" b = a + a self.assertFalse(FpS.equal(a, b)) a = "aaba" b = "ba^4" self.assertFalse(FpS.equal(a, b))
def test_eq_(self): FpS = FpSemigroup("ab", [["a^10", "a"], ["bbb", "b"], ["ba", "ab"]]) a = "aba" b = a self.assertTrue(FpS.equal(a, b)) a = "aaba" b = "ba^3" self.assertTrue(FpS.equal(a, b)) a = "" self.assertEqual(a, a)
def test_equal(self): S = FpSemigroup("ab", [["a", "a^5"], ["b", "bb"], ["ab", "ba"]]) self.assertTrue(S.equal("a", "a^5")) self.assertTrue(S.equal("a", "aaaaa")) self.assertTrue(S.equal("abb", "ba")) self.assertTrue(S.equal("ab", "((a)^3b)^167")) S = FpSemigroup("ab", []) with self.assertRaises(ValueError): S.equal("a", "b")
def test_valid_init(self): FpS = FpSemigroup("ab", [["aa", "a"], ["bbb", "b"], ["ba", "ab"]]) FpS.equal("a", "aba") FpS = FpSemigroup("mo", [["m", "mm"], ["ooo", "o"], ["mo", "om"]]) FpS.equal("moo", "ooo") FpS = FpSemigroup( "cowie", [["c", "o"], ["o", "w"], ["w", "i"], ["i", "e"], ["ee", "e"]]) FpS.equal("cowie", "cowie") FpS2 = FpSemigroup('~', [["~~", "~"]]) FpS2.equal("~", "~~") with self.assertRaises(TypeError): FpS.equal(FpS, FpS) with self.assertRaises(ValueError): FpS.equal("abc", "abc")