code: def test_monomials():
      # total_degree tests
      assert set(itermonomials([], 0)) == {S.One}
      assert set(itermonomials([], 1)) == {S.One}
      assert set(itermonomials([], 2)) == {S.One}
  
      assert set(itermonomials([], 0, 0)) == {S.One}
      assert set(itermonomials([], 1, 0)) == {S.One}
      assert set(itermonomials([], 2, 0)) == {S.One}
  
      raises(StopIteration, lambda: next(itermonomials([], 0, 1)))
      raises(StopIteration, lambda: next(itermonomials([], 0, 2)))
      raises(StopIteration, lambda: next(itermonomials([], 0, 3)))
  
      assert set(itermonomials([], 0, 1)) == set()
      assert set(itermonomials([], 0, 2)) == set()
      assert set(itermonomials([], 0, 3)) == set()
  
      raises(ValueError, lambda: set(itermonomials([], -1)))
      raises(ValueError, lambda: set(itermonomials([x], -1)))
      raises(ValueError, lambda: set(itermonomials([x, y], -1)))
  
      assert set(itermonomials([x], 0)) == {S.One}
      assert set(itermonomials([x], 1)) == {S.One, x}
      assert set(itermonomials([x], 2)) == {S.One, x, x**2}
      assert set(itermonomials([x], 3)) == {S.One, x, x**2, x**3}
  
      assert set(itermonomials([x, y], 0)) == {S.One}
      assert set(itermonomials([x, y], 1)) == {S.One, x, y}
      assert set(itermonomials([x, y], 2)) == {
          S.One,
          x,
          y,
          x**2,
          y**2,
          x * y,
      }
      assert set(itermonomials([x, y], 3)) == {
          S.One,
          x,
          y,
          x**2,
          x**3,
          y**2,
          y**3,
          x * y,
          x * y**2,
          y * x**2,
      }
  
      i, j, k = symbols("i j k", commutative=False)
      assert set(itermonomials([i, j, k], 0)) == {S.One}
      assert set(itermonomials([i, j, k], 1)) == {S.One, i, j, k}
      assert set(itermonomials([i, j, k], 2)) == {
          S.One,
          i,
          j,
          k,
          i**2,
          j**2,
          k**2,
          i * j,
          i * k,
          j * i,
          j * k,
          k * i,
          k * j,
      }
  
      assert set(itermonomials([i, j, k], 3)) == {
          S.One,
          i,
          j,
          k,
          i**2,
          j**2,
          k**2,
          i * j,
          i * k,
          j * i,
          j * k,
          k * i,
          k * j,
          i**3,
          j**3,
          k**3,
          i**2 * j,
          i**2 * k,
          j * i**2,
          k * i**2,
          j**2 * i,
          j**2 * k,
          i * j**2,
          k * j**2,
          k**2 * i,
          k**2 * j,
          i * k**2,
          j * k**2,
          i * j * i,
          i * k * i,
          j * i * j,
          j * k * j,
          k * i * k,
          k * j * k,
          i * j * k,
          i * k * j,
          j * i * k,
          j * k * i,
          k * i * j,
          k * j * i,
      }
  
      assert set(itermonomials([x, i, j], 0)) == {S.One}
      assert set(itermonomials([x, i, j], 1)) == {S.One, x, i, j}
      assert set(itermonomials([x, i, j], 2)) == {
          S.One,
          x,
          i,
          j,
          x * i,
          x * j,
          i * j,
          j * i,
          x**2,
          i**2,
          j**2,
      }
      assert set(itermonomials([x, i, j], 3)) == {
          S.One,
          x,
          i,
          j,
          x * i,
          x * j,
          i * j,
          j * i,
          x**2,
          i**2,
          j**2,
          x**3,
          i**3,
          j**3,
          x**2 * i,
          x**2 * j,
          x * i**2,
          j * i**2,
          i**2 * j,
          i * j * i,
          x * j**2,
          i * j**2,
          j**2 * i,
          j * i * j,
          x * i * j,
          x * j * i,
      }
  
      # degree_list tests
      assert set(itermonomials([], [])) == {S.One}
  
      raises(ValueError, lambda: set(itermonomials([], [0])))
      raises(ValueError, lambda: set(itermonomials([], [1])))
      raises(ValueError, lambda: set(itermonomials([], [2])))
  
      raises(ValueError, lambda: set(itermonomials([x], [1], [])))
      raises(ValueError, lambda: set(itermonomials([x], [1, 2], [])))
      raises(ValueError, lambda: set(itermonomials([x], [1, 2, 3], [])))
  
      raises(ValueError, lambda: set(itermonomials([x], [], [1])))
      raises(ValueError, lambda: set(itermonomials([x], [], [1, 2])))
      raises(ValueError, lambda: set(itermonomials([x], [], [1, 2, 3])))
  
      raises(
          ValueError,
          lambda: set(itermonomials([x, y], [1, 2], [1, 2, 3])),
      )
      raises(
          ValueError,
          lambda: set(itermonomials([x, y, z], [1, 2, 3], [0, 1])),
      )
  
      raises(ValueError, lambda: set(itermonomials([x], [1], [-1])))
      raises(
          ValueError,
          lambda: set(itermonomials([x, y], [1, 2], [1, -1])),
      )
  
      raises(ValueError, lambda: set(itermonomials([], [], 1)))
      raises(ValueError, lambda: set(itermonomials([], [], 2)))
      raises(ValueError, lambda: set(itermonomials([], [], 3)))
  
      raises(
          ValueError, lambda: set(itermonomials([x, y], [0, 1], [1, 2]))
      )
      raises(
          ValueError,
          lambda: set(itermonomials([x, y, z], [0, 0, 3], [0, 1, 2])),
      )
  
      assert set(itermonomials([x], [0])) == {S.One}
      assert set(itermonomials([x], [1])) == {S.One, x}
      assert set(itermonomials([x], [2])) == {S.One, x, x**2}
      assert set(itermonomials([x], [3])) == {S.One, x, x**2, x**3}
  
      assert set(itermonomials([x], [3], [1])) == {x, x**3, x**2}
      assert set(itermonomials([x], [3], [2])) == {x**3, x**2}
  
      assert set(itermonomials([x, y], 3, 3)) == {
          x**3,
          x**2 * y,
          x * y**2,
          y**3,
      }
      assert set(itermonomials([x, y], 3, 2)) == {
          x**2,
          x * y,
          y**2,
          x**3,
          x**2 * y,
          x * y**2,
          y**3,
      }
  
      assert set(itermonomials([x, y], [0, 0])) == {S.One}
      assert set(itermonomials([x, y], [0, 1])) == {S.One, y}
      assert set(itermonomials([x, y], [0, 2])) == {S.One, y, y**2}
      assert set(itermonomials([x, y], [0, 2], [0, 1])) == {y, y**2}
      assert set(itermonomials([x, y], [0, 2], [0, 2])) == {y**2}
  
      assert set(itermonomials([x, y], [1, 0])) == {S.One, x}
      assert set(itermonomials([x, y], [1, 1])) == {S.One, x, y, x * y}
      assert set(itermonomials([x, y], [1, 2])) == {
          S.One,
          x,
          y,
          x * y,
          y**2,
          x * y**2,
      }
      assert set(itermonomials([x, y], [1, 2], [1, 1])) == {
          x * y,
          x * y**2,
      }
      assert set(itermonomials([x, y], [1, 2], [1, 2])) == {x * y**2}
  
      assert set(itermonomials([x, y], [2, 0])) == {S.One, x, x**2}
      assert set(itermonomials([x, y], [2, 1])) == {
          S.One,
          x,
          y,
          x * y,
          x**2,
          x**2 * y,
      }
      assert set(itermonomials([x, y], [2, 2])) == {
          S.One,
          y**2,
          x * y**2,
          x,
          x * y,
          x**2,
          x**2 * y**2,
          y,
          x**2 * y,
      }
  
      i, j, k = symbols("i j k", commutative=False)
      assert set(itermonomials([i, j, k], 2, 2)) == {
          k * i,
          i**2,
          i * j,
          j * k,
          j * i,
          k**2,
          j**2,
          k * j,
          i * k,
      }
      assert set(itermonomials([i, j, k], 3, 2)) == {
          j * k**2,
          i * k**2,
          k * i * j,
          k * i**2,
          k**2,
          j * k * j,
          k * j**2,
          i * k * i,
          i * j,
          j**2 * k,
          i**2 * j,
          j * i * k,
          j**3,
          i**3,
          k * j * i,
          j * k * i,
          j * i,
          k**2 * j,
          j * i**2,
          k * j,
          k * j * k,
          i * j * i,
          j * i * j,
          i * j**2,
          j**2,
          k * i * k,
          i**2,
          j * k,
          i * k,
          i * k * j,
          k**3,
          i**2 * k,
          j**2 * i,
          k**2 * i,
          i * j * k,
          k * i,
      }
      assert set(itermonomials([i, j, k], [0, 0, 0])) == {S.One}
      assert set(itermonomials([i, j, k], [0, 0, 1])) == {1, k}
      assert set(itermonomials([i, j, k], [0, 1, 0])) == {1, j}
      assert set(itermonomials([i, j, k], [1, 0, 0])) == {i, 1}
      assert set(itermonomials([i, j, k], [0, 0, 2])) == {k**2, 1, k}
      assert set(itermonomials([i, j, k], [0, 2, 0])) == {1, j, j**2}
      assert set(itermonomials([i, j, k], [2, 0, 0])) == {i, 1, i**2}
      assert set(itermonomials([i, j, k], [1, 1, 1])) == {
          1,
          k,
          j,
          j * k,
          i * k,
          i,
          i * j,
          i * j * k,
      }
      assert set(itermonomials([i, j, k], [2, 2, 2])) == {
          1,
          k,
          i**2 * k**2,
          j * k,
          j**2,
          i,
          i * k,
          j * k**2,
          i * j**2 * k**2,
          i**2 * j,
          i**2 * j**2,
          k**2,
          j**2 * k,
          i * j**2 * k,
          j**2 * k**2,
          i * j,
          i**2 * k,
          i**2 * j**2 * k,
          j,
          i**2 * j * k,
          i * j**2,
          i * k**2,
          i * j * k,
          i**2 * j**2 * k**2,
          i * j * k**2,
          i**2,
          i**2 * j * k**2,
      }
  
      assert set(itermonomials([x, j, k], [0, 0, 0])) == {S.One}
      assert set(itermonomials([x, j, k], [0, 0, 1])) == {1, k}
      assert set(itermonomials([x, j, k], [0, 1, 0])) == {1, j}
      assert set(itermonomials([x, j, k], [1, 0, 0])) == {x, 1}
      assert set(itermonomials([x, j, k], [0, 0, 2])) == {k**2, 1, k}
      assert set(itermonomials([x, j, k], [0, 2, 0])) == {1, j, j**2}
      assert set(itermonomials([x, j, k], [2, 0, 0])) == {x, 1, x**2}
      assert set(itermonomials([x, j, k], [1, 1, 1])) == {
          1,
          k,
          j,
          j * k,
          x * k,
          x,
          x * j,
          x * j * k,
      }
      assert set(itermonomials([x, j, k], [2, 2, 2])) == {
          1,
          k,
          x**2 * k**2,
          j * k,
          j**2,
          x,
          x * k,
          j * k**2,
          x * j**2 * k**2,
          x**2 * j,
          x**2 * j**2,
          k**2,
          j**2 * k,
          x * j**2 * k,
          j**2 * k**2,
          x * j,
          x**2 * k,
          x**2 * j**2 * k,
          j,
          x**2 * j * k,
          x * j**2,
          x * k**2,
          x * j * k,
          x**2 * j**2 * k**2,
          x * j * k**2,
          x**2,
          x**2 * j * k**2,
      }
  
file_path: sympy/sympy/polys/tests/test_monomials.py
imports: from sympy.polys.monomials import itermonomials, monomial_count, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, monomial_pow, Monomial
  from sympy.polys.polyerrors import ExactQuotientFailed
  from sympy.abc import a, b, c, x, y, z
  from sympy.core import S, symbols
  from sympy.testing.pytest import raises
label_desc: Use image node_id 1 for calling a global function with example usage: test_monomials() without return types