code: def test__sort_gens():
      assert _sort_gens([]) == ()
  
      assert _sort_gens([x]) == (x,)
      assert _sort_gens([p]) == (p,)
      assert _sort_gens([q]) == (q,)
  
      assert _sort_gens([x, p]) == (x, p)
      assert _sort_gens([p, x]) == (x, p)
      assert _sort_gens([q, p]) == (p, q)
  
      assert _sort_gens([q, p, x]) == (x, p, q)
  
      assert _sort_gens([x, p, q], wrt=x) == (x, p, q)
      assert _sort_gens([x, p, q], wrt=p) == (p, x, q)
      assert _sort_gens([x, p, q], wrt=q) == (q, x, p)
  
      assert _sort_gens([x, p, q], wrt="x") == (x, p, q)
      assert _sort_gens([x, p, q], wrt="p") == (p, x, q)
      assert _sort_gens([x, p, q], wrt="q") == (q, x, p)
  
      assert _sort_gens([x, p, q], wrt="x,q") == (x, q, p)
      assert _sort_gens([x, p, q], wrt="q,x") == (q, x, p)
      assert _sort_gens([x, p, q], wrt="p,q") == (p, q, x)
      assert _sort_gens([x, p, q], wrt="q,p") == (q, p, x)
  
      assert _sort_gens([x, p, q], wrt="x, q") == (x, q, p)
      assert _sort_gens([x, p, q], wrt="q, x") == (q, x, p)
      assert _sort_gens([x, p, q], wrt="p, q") == (p, q, x)
      assert _sort_gens([x, p, q], wrt="q, p") == (q, p, x)
  
      assert _sort_gens([x, p, q], wrt=[x, "q"]) == (x, q, p)
      assert _sort_gens([x, p, q], wrt=[q, "x"]) == (q, x, p)
      assert _sort_gens([x, p, q], wrt=[p, "q"]) == (p, q, x)
      assert _sort_gens([x, p, q], wrt=[q, "p"]) == (q, p, x)
  
      assert _sort_gens([x, p, q], wrt=["x", "q"]) == (x, q, p)
      assert _sort_gens([x, p, q], wrt=["q", "x"]) == (q, x, p)
      assert _sort_gens([x, p, q], wrt=["p", "q"]) == (p, q, x)
      assert _sort_gens([x, p, q], wrt=["q", "p"]) == (q, p, x)
  
      assert _sort_gens([x, p, q], sort="x > p > q") == (x, p, q)
      assert _sort_gens([x, p, q], sort="p > x > q") == (p, x, q)
      assert _sort_gens([x, p, q], sort="p > q > x") == (p, q, x)
  
      assert _sort_gens([x, p, q], wrt="x", sort="q > p") == (x, q, p)
      assert _sort_gens([x, p, q], wrt="p", sort="q > x") == (p, q, x)
      assert _sort_gens([x, p, q], wrt="q", sort="p > x") == (q, p, x)
  
      # https://github.com/sympy/sympy/issues/19353
      n1 = Symbol("\n1")
      assert _sort_gens([n1]) == (n1,)
      assert _sort_gens([x, n1]) == (x, n1)
  
      X = symbols("x0,x1,x2,x10,x11,x12,x20,x21,x22")
  
      assert _sort_gens(X) == X
  
imports: from sympy.core.mul import Mul
  from sympy.core.numbers import Integer, pi
  from sympy.core.relational import Eq
  from sympy.core.singleton import S
  from sympy.core.symbol import Symbol, symbols
  from sympy.functions.elementary.exponential import exp
  from sympy.functions.elementary.miscellaneous import sqrt
  from sympy.functions.elementary.trigonometric import cos, sin
  from sympy.integrals.integrals import Integral
  from sympy.testing.pytest import raises
  from sympy.polys.polyutils import _nsort, _sort_gens, _unify_gens, _analyze_gens, _sort_factors, parallel_dict_from_expr, dict_from_expr
  from sympy.polys.polyerrors import PolynomialError
  from sympy.polys.domains import ZZ
label_desc: Use image node_id 2 for calling a global function with example usage: test__sort_gens() without return types