code: def test_rewrite():
      x, y = Symbol("x", real=True), Symbol("y")
      assert Heaviside(x).rewrite(Piecewise) == (
          Piecewise((0, x < 0), (Heaviside(0), Eq(x, 0)), (1, True))
      )
      assert Heaviside(y).rewrite(Piecewise) == (
          Piecewise((0, y < 0), (Heaviside(0), Eq(y, 0)), (1, True))
      )
      assert Heaviside(x, y).rewrite(Piecewise) == (
          Piecewise((0, x < 0), (y, Eq(x, 0)), (1, True))
      )
      assert Heaviside(x, 0).rewrite(Piecewise) == (
          Piecewise((0, x <= 0), (1, True))
      )
      assert Heaviside(x, 1).rewrite(Piecewise) == (
          Piecewise((0, x < 0), (1, True))
      )
      assert Heaviside(x, nan).rewrite(Piecewise) == (
          Piecewise((0, x < 0), (nan, Eq(x, 0)), (1, True))
      )
  
      assert (
          Heaviside(x).rewrite(sign)
          == Heaviside(x, H0=Heaviside(0)).rewrite(sign)
          == Piecewise(
              (sign(x) / 2 + S(1) / 2, Eq(Heaviside(0), S(1) / 2)),
              (
                  Piecewise(
                      (sign(x) / 2 + S(1) / 2, Ne(x, 0)),
                      (Heaviside(0), True),
                  ),
                  True,
              ),
          )
      )
  
      assert Heaviside(y).rewrite(sign) == Heaviside(y)
      assert Heaviside(x, S.Half).rewrite(sign) == (sign(x) + 1) / 2
      assert Heaviside(x, y).rewrite(sign) == Piecewise(
          (sign(x) / 2 + S(1) / 2, Eq(y, S(1) / 2)),
          (
              Piecewise((sign(x) / 2 + S(1) / 2, Ne(x, 0)), (y, True)),
              True,
          ),
      )
  
      assert DiracDelta(y).rewrite(Piecewise) == Piecewise(
          (DiracDelta(0), Eq(y, 0)), (0, True)
      )
      assert DiracDelta(y, 1).rewrite(Piecewise) == DiracDelta(y, 1)
      assert DiracDelta(x - 5).rewrite(Piecewise) == (
          Piecewise((DiracDelta(0), Eq(x - 5, 0)), (0, True))
      )
  
      assert (x * DiracDelta(x - 10)).rewrite(
          SingularityFunction
      ) == x * SingularityFunction(x, 10, -1)
      assert 5 * x * y * DiracDelta(y, 1).rewrite(
          SingularityFunction
      ) == 5 * x * y * SingularityFunction(y, 0, -2)
      assert DiracDelta(0).rewrite(
          SingularityFunction
      ) == SingularityFunction(0, 0, -1)
      assert DiracDelta(0, 1).rewrite(
          SingularityFunction
      ) == SingularityFunction(0, 0, -2)
  
      assert Heaviside(x).rewrite(
          SingularityFunction
      ) == SingularityFunction(x, 0, 0)
      assert 5 * x * y * Heaviside(y + 1).rewrite(
          SingularityFunction
      ) == 5 * x * y * SingularityFunction(y, -1, 0)
      assert ((x - 3) ** 3 * Heaviside(x - 3)).rewrite(
          SingularityFunction
      ) == (x - 3) ** 3 * SingularityFunction(x, 3, 0)
      assert Heaviside(0).rewrite(SingularityFunction) == S.Half
  
file_path: sympy/sympy/functions/special/tests/test_delta_functions.py
imports: from sympy.core.numbers import I, nan, oo, pi
  from sympy.core.relational import Eq, Ne
  from sympy.core.singleton import S
  from sympy.core.symbol import Symbol, symbols
  from sympy.functions.elementary.complexes import adjoint, conjugate, sign, transpose
  from sympy.functions.elementary.miscellaneous import sqrt
  from sympy.functions.elementary.piecewise import Piecewise
  from sympy.functions.special.delta_functions import DiracDelta, Heaviside
  from sympy.functions.special.singularity_functions import SingularityFunction
  from sympy.simplify.simplify import signsimp
  from sympy.testing.pytest import raises
  from sympy.core.expr import unchanged
  from sympy.core.function import ArgumentIndexError
label_desc: Use image node_id 3 for calling a global function with example usage: test_rewrite() without return types