code: def test_riemann_invariants():
      baser, gensr = riemann_bsgs
      # R^{d0 d1}_{d1 d0}; ord = [d0,-d0,d1,-d1]; g = [0,2,3,1,4,5]
      # T_c = -R^{d0 d1}_{d0 d1}; can = [0,2,1,3,5,4]
      g = Permutation([0, 2, 3, 1, 4, 5])
      can = canonicalize(g, list(range(2, 4)), 0, (baser, gensr, 1, 0))
      assert can == [0, 2, 1, 3, 5, 4]
      # use a non minimal BSGS
      can = canonicalize(
          g,
          list(range(2, 4)),
          0,
          (
              [2, 0],
              [
                  Permutation([1, 0, 2, 3, 5, 4]),
                  Permutation([2, 3, 0, 1, 4, 5]),
              ],
              1,
              0,
          ),
      )
      assert can == [0, 2, 1, 3, 5, 4]
  
      """
      The following tests in test_riemann_invariants and in
      test_riemann_invariants1 have been checked using xperm.c from XPerm in
      in [1] and with an older version contained in [2]
  
      [1] xperm.c part of xPerm written by J. M. Martin-Garcia
          http://www.xact.es/index.html
      [2] test_xperm.cc in cadabra by Kasper Peeters, http://cadabra.phi-sci.com/
      """
      # R_d11^d1_d0^d5 * R^{d6 d4 d0}_d5 * R_{d7 d2 d8 d9} *
      # R_{d10 d3 d6 d4} * R^{d2 d7 d11}_d1 * R^{d8 d9 d3 d10}
      # ord: contravariant d_k ->2*k, covariant d_k -> 2*k+1
      # T_c = R^{d0 d1 d2 d3} * R_{d0 d1}^{d4 d5} * R_{d2 d3}^{d6 d7} *
      # R_{d4 d5}^{d8 d9} * R_{d6 d7}^{d10 d11} * R_{d8 d9 d10 d11}
      g = Permutation(
          [
              23,
              2,
              1,
              10,
              12,
              8,
              0,
              11,
              15,
              5,
              17,
              19,
              21,
              7,
              13,
              9,
              4,
              14,
              22,
              3,
              16,
              18,
              6,
              20,
              24,
              25,
          ]
      )
      can = canonicalize(g, list(range(24)), 0, (baser, gensr, 6, 0))
      assert can == [
          0,
          2,
          4,
          6,
          1,
          3,
          8,
          10,
          5,
          7,
          12,
          14,
          9,
          11,
          16,
          18,
          13,
          15,
          20,
          22,
          17,
          19,
          21,
          23,
          24,
          25,
      ]
  
      # use a non minimal BSGS
      can = canonicalize(
          g,
          list(range(24)),
          0,
          (
              [2, 0],
              [
                  Permutation([1, 0, 2, 3, 5, 4]),
                  Permutation([2, 3, 0, 1, 4, 5]),
              ],
              6,
              0,
          ),
      )
      assert can == [
          0,
          2,
          4,
          6,
          1,
          3,
          8,
          10,
          5,
          7,
          12,
          14,
          9,
          11,
          16,
          18,
          13,
          15,
          20,
          22,
          17,
          19,
          21,
          23,
          24,
          25,
      ]
  
      g = Permutation(
          [
              0,
              2,
              5,
              7,
              4,
              6,
              9,
              11,
              8,
              10,
              13,
              15,
              12,
              14,
              17,
              19,
              16,
              18,
              21,
              23,
              20,
              22,
              25,
              27,
              24,
              26,
              29,
              31,
              28,
              30,
              33,
              35,
              32,
              34,
              37,
              39,
              36,
              38,
              1,
              3,
              40,
              41,
          ]
      )
      can = canonicalize(g, list(range(40)), 0, (baser, gensr, 10, 0))
      assert can == [
          0,
          2,
          4,
          6,
          1,
          3,
          8,
          10,
          5,
          7,
          12,
          14,
          9,
          11,
          16,
          18,
          13,
          15,
          20,
          22,
          17,
          19,
          24,
          26,
          21,
          23,
          28,
          30,
          25,
          27,
          32,
          34,
          29,
          31,
          36,
          38,
          33,
          35,
          37,
          39,
          40,
          41,
      ]
  
file_path: sympy/sympy/combinatorics/tests/test_tensor_can.py
imports: from sympy.combinatorics.permutations import Permutation, Perm
  from sympy.combinatorics.tensor_can import perm_af_direct_product, dummy_sgs, riemann_bsgs, get_symmetric_group_sgs, canonicalize, bsgs_direct_product
  from sympy.combinatorics.testutil import canonicalize_naive, graph_certificate
  from sympy.testing.pytest import skip, XFAIL
label_desc: Use image node_id 9 for calling a global function with example usage: test_riemann_invariants() without return types