code: def test_units():
      R = QQ.old_poly_ring(x)
      assert R.is_unit(R.convert(1))
      assert R.is_unit(R.convert(2))
      assert not R.is_unit(R.convert(x))
      assert not R.is_unit(R.convert(1 + x))
  
      R = QQ.old_poly_ring(x, order="ilex")
      assert R.is_unit(R.convert(1))
      assert R.is_unit(R.convert(2))
      assert not R.is_unit(R.convert(x))
      assert R.is_unit(R.convert(1 + x))
  
      R = ZZ.old_poly_ring(x)
      assert R.is_unit(R.convert(1))
      assert not R.is_unit(R.convert(2))
      assert not R.is_unit(R.convert(x))
      assert not R.is_unit(R.convert(1 + x))
  
file_path: sympy/sympy/polys/domains/tests/test_polynomialring.py
imports: from sympy.polys.domains import QQ, ZZ
  from sympy.polys.polyerrors import ExactQuotientFailed, CoercionFailed, NotReversible
  from sympy.abc import x, y
  from sympy.testing.pytest import raises
label_desc: Use image node_id 5 for calling a global function with example usage: test_units() without return types