Test Utilities¶
-
sympy.combinatorics.testutil.
_cmp_perm_lists
(first, second)[source]¶ Compare two lists of permutations as sets.
This is used for testing purposes. Since the array form of a permutation is currently a list, Permutation is not hashable and cannot be put into a set.
Examples
>>> from sympy.combinatorics.permutations import Permutation >>> from sympy.combinatorics.testutil import _cmp_perm_lists >>> a = Permutation([0, 2, 3, 4, 1]) >>> b = Permutation([1, 2, 0, 4, 3]) >>> c = Permutation([3, 4, 0, 1, 2]) >>> ls1 = [a, b, c] >>> ls2 = [b, c, a] >>> _cmp_perm_lists(ls1, ls2) True
-
sympy.combinatorics.testutil.
_verify_bsgs
(group, base, gens)[source]¶ Verify the correctness of a base and strong generating set.
This is a naive implementation using the definition of a base and a strong generating set relative to it. There are other procedures for verifying a base and strong generating set, but this one will serve for more robust testing.
Examples
>>> from sympy.combinatorics.named_groups import AlternatingGroup >>> from sympy.combinatorics.testutil import _verify_bsgs >>> A = AlternatingGroup(4) >>> A.schreier_sims() >>> _verify_bsgs(A, A.base, A.strong_gens) True
-
sympy.combinatorics.testutil.
_verify_centralizer
(group, arg, centr=None)[source]¶ Verify the centralizer of a group/set/element inside another group.
This is used for testing
.centralizer()
fromsympy.combinatorics.perm_groups
See also
_naive_list_centralizer
,sympy.combinatorics.perm_groups.PermutationGroup.centralizer
,_cmp_perm_lists
Examples
>>> from sympy.combinatorics.named_groups import (SymmetricGroup, ... AlternatingGroup) >>> from sympy.combinatorics.perm_groups import PermutationGroup >>> from sympy.combinatorics.permutations import Permutation >>> from sympy.combinatorics.testutil import _verify_centralizer >>> S = SymmetricGroup(5) >>> A = AlternatingGroup(5) >>> centr = PermutationGroup([Permutation([0, 1, 2, 3, 4])]) >>> _verify_centralizer(S, A, centr) True