code: def test_index_permutations_with_dummies():
      a, b, c, d = symbols("a b c d")
      p, q, r, s = symbols("p q r s", cls=Dummy)
      f, g = map(Function, "fg")
      P = PermutationOperator
  
      # No dummy substitution necessary
      expr = f(a, b, p, q) - f(b, a, p, q)
      assert simplify_index_permutations(expr, [P(a, b)]) == P(
          a, b
      ) * f(a, b, p, q)
  
      # Cases where dummy substitution is needed
      expected = P(a, b) * substitute_dummies(f(a, b, p, q))
  
      expr = f(a, b, p, q) - f(b, a, q, p)
      result = simplify_index_permutations(expr, [P(a, b)])
      assert expected == substitute_dummies(result)
  
      expr = f(a, b, q, p) - f(b, a, p, q)
      result = simplify_index_permutations(expr, [P(a, b)])
      assert expected == substitute_dummies(result)
  
      # A case where nothing can be done
      expr = f(a, b, q, p) - g(b, a, p, q)
      result = simplify_index_permutations(expr, [P(a, b)])
      assert expr == result
  
imports: from sympy.physics.secondquant import Dagger, Bd, VarBosonicBasis, BBra, B, BKet, FixedBosonicBasis, matrix_rep, apply_operators, InnerProduct, Commutator, KroneckerDelta, AnnihilateBoson, CreateBoson, BosonicOperator, F, Fd, FKet, BosonState, CreateFermion, AnnihilateFermion, evaluate_deltas, AntiSymmetricTensor, contraction, NO, wicks, PermutationOperator, simplify_index_permutations, _sort_anticommuting_fermions, _get_ordered_dummies, substitute_dummies, FockStateBosonKet, ContractionAppliesOnlyToFermions
  from sympy.concrete.summations import Sum
  from sympy.core.function import Function, expand
  from sympy.core.numbers import I, Rational
  from sympy.core.singleton import S
  from sympy.core.symbol import Dummy, Symbol, symbols
  from sympy.functions.elementary.miscellaneous import sqrt
  from sympy.printing.repr import srepr
  from sympy.simplify.simplify import simplify
  from sympy.testing.pytest import slow, raises
  from sympy.printing.latex import latex
label_desc: Use image node_id 2 for calling a global function with example usage: test_index_permutations_with_dummies() without return types