code: def test_sign():
      assert sign(1.2) == 1
      assert sign(-1.2) == -1
      assert sign(3 * I) == I
      assert sign(-3 * I) == -I
      assert sign(0) == 0
      assert sign(0, evaluate=False).doit() == 0
      assert sign(oo, evaluate=False).doit() == 1
      assert sign(nan) is nan
      assert sign(2 + 2 * I).doit() == sqrt(2) * (2 + 2 * I) / 4
      assert sign(2 + 3 * I).simplify() == sign(2 + 3 * I)
      assert sign(2 + 2 * I).simplify() == sign(1 + I)
      assert sign(im(sqrt(1 - sqrt(3)))) == 1
      assert sign(sqrt(1 - sqrt(3))) == I
  
      x = Symbol("x")
      assert sign(x).is_finite is True
      assert sign(x).is_complex is True
      assert sign(x).is_imaginary is None
      assert sign(x).is_integer is None
      assert sign(x).is_real is None
      assert sign(x).is_zero is None
      assert sign(x).doit() == sign(x)
      assert sign(1.2 * x) == sign(x)
      assert sign(2 * x) == sign(x)
      assert sign(I * x) == I * sign(x)
      assert sign(-2 * I * x) == -I * sign(x)
      assert sign(conjugate(x)) == conjugate(sign(x))
  
      p = Symbol("p", positive=True)
      n = Symbol("n", negative=True)
      m = Symbol("m", negative=True)
      assert sign(2 * p * x) == sign(x)
      assert sign(n * x) == -sign(x)
      assert sign(n * m * x) == sign(x)
  
      x = Symbol("x", imaginary=True)
      assert sign(x).is_imaginary is True
      assert sign(x).is_integer is False
      assert sign(x).is_real is False
      assert sign(x).is_zero is False
      assert sign(x).diff(x) == 2 * DiracDelta(-I * x)
      assert sign(x).doit() == x / Abs(x)
      assert conjugate(sign(x)) == -sign(x)
  
      x = Symbol("x", real=True)
      assert sign(x).is_imaginary is False
      assert sign(x).is_integer is True
      assert sign(x).is_real is True
      assert sign(x).is_zero is None
      assert sign(x).diff(x) == 2 * DiracDelta(x)
      assert sign(x).doit() == sign(x)
      assert conjugate(sign(x)) == sign(x)
  
      x = Symbol("x", nonzero=True)
      assert sign(x).is_imaginary is False
      assert sign(x).is_integer is True
      assert sign(x).is_real is True
      assert sign(x).is_zero is False
      assert sign(x).doit() == x / Abs(x)
      assert sign(Abs(x)) == 1
      assert Abs(sign(x)) == 1
  
      x = Symbol("x", positive=True)
      assert sign(x).is_imaginary is False
      assert sign(x).is_integer is True
      assert sign(x).is_real is True
      assert sign(x).is_zero is False
      assert sign(x).doit() == x / Abs(x)
      assert sign(Abs(x)) == 1
      assert Abs(sign(x)) == 1
  
      x = 0
      assert sign(x).is_imaginary is False
      assert sign(x).is_integer is True
      assert sign(x).is_real is True
      assert sign(x).is_zero is True
      assert sign(x).doit() == 0
      assert sign(Abs(x)) == 0
      assert Abs(sign(x)) == 0
  
      nz = Symbol("nz", nonzero=True, integer=True)
      assert sign(nz).is_imaginary is False
      assert sign(nz).is_integer is True
      assert sign(nz).is_real is True
      assert sign(nz).is_zero is False
      assert sign(nz) ** 2 == 1
      assert (sign(nz) ** 3).args == (sign(nz), 3)
  
      assert sign(Symbol("x", nonnegative=True)).is_nonnegative
      assert sign(Symbol("x", nonnegative=True)).is_nonpositive is None
      assert sign(Symbol("x", nonpositive=True)).is_nonnegative is None
      assert sign(Symbol("x", nonpositive=True)).is_nonpositive
      assert sign(Symbol("x", real=True)).is_nonnegative is None
      assert sign(Symbol("x", real=True)).is_nonpositive is None
      assert (
          sign(Symbol("x", real=True, zero=False)).is_nonpositive
          is None
      )
  
      x, y = Symbol("x", real=True), Symbol("y")
      f = Function("f")
      assert sign(x).rewrite(Piecewise) == Piecewise(
          (1, x > 0), (-1, x < 0), (0, True)
      )
      assert sign(y).rewrite(Piecewise) == sign(y)
      assert (
          sign(x).rewrite(Heaviside)
          == 2 * Heaviside(x, H0=S(1) / 2) - 1
      )
      assert sign(y).rewrite(Heaviside) == sign(y)
      assert sign(y).rewrite(Abs) == Piecewise(
          (0, Eq(y, 0)), (y / Abs(y), True)
      )
      assert sign(f(y)).rewrite(Abs) == Piecewise(
          (0, Eq(f(y), 0)), (f(y) / Abs(f(y)), True)
      )
  
      # evaluate what can be evaluated
      assert sign(exp_polar(I * pi) * pi) is S.NegativeOne
  
      eq = (
          -sqrt(10 + 6 * sqrt(3))
          + sqrt(1 + sqrt(3))
          + sqrt(3 + 3 * sqrt(3))
      )
      # if there is a fast way to know when and when you cannot prove an
      # expression like this is zero then the equality to zero is ok
      assert sign(eq).func is sign or sign(eq) == 0
      # but sometimes it's hard to do this so it's better not to load
      # abs down with tests that will be very slow
      q = 1 + sqrt(2) - 2 * sqrt(3) + 1331 * sqrt(6)
      p = expand(q**3) ** Rational(1, 3)
      d = p - q
      assert sign(d).func is sign or sign(d) == 0
  
imports: from sympy.core.expr import Expr
  from sympy.core.function import Derivative, Function, Lambda, expand
  from sympy.core.numbers import E, I, Rational, comp, nan, oo, pi, zoo
  from sympy.core.relational import Eq
  from sympy.core.singleton import S
  from sympy.core.symbol import Symbol, symbols
  from sympy.functions.elementary.complexes import Abs, adjoint, arg, conjugate, im, re, sign, transpose
  from sympy.functions.elementary.exponential import exp, exp_polar, log
  from sympy.functions.elementary.miscellaneous import sqrt
  from sympy.functions.elementary.piecewise import Piecewise
  from sympy.functions.elementary.trigonometric import acos, atan, atan2, cos, sin
  from sympy.functions.elementary.hyperbolic import sinh
  from sympy.functions.special.delta_functions import DiracDelta, Heaviside
  from sympy.integrals.integrals import Integral
  from sympy.matrices.dense import Matrix
  from sympy.matrices.expressions.funcmatrix import FunctionMatrix
  from sympy.matrices.expressions.matexpr import MatrixSymbol
  from sympy.matrices.immutable import ImmutableMatrix, ImmutableSparseMatrix
  from sympy.matrices import SparseMatrix
  from sympy.sets.sets import Interval
  from sympy.core.expr import unchanged
  from sympy.core.function import ArgumentIndexError
  from sympy.testing.pytest import XFAIL, raises, _both_exp_pow
label_desc: Use image node_id 4 for calling a global function with example usage: test_sign() without return types