def test_power(): a, b, c, e = (Word(c) for c in 'abce') F = FreeGroup({a, b, c, e}, e) for x in (a, b, c, e): assert F.power(x, 0) == e assert F.power(x, 1) == x assert freely_reduced(F, x + F.power(x, -1)) == e assert F.power(x, 2) == x + x assert F.power(x, 3) == x + x + x