code: def test_rewrite():
      assert SingularityFunction(x, 4, 5).rewrite(Piecewise) == (
          Piecewise(((x - 4) ** 5, x - 4 >= 0), (0, True))
      )
      assert SingularityFunction(x, -10, 0).rewrite(Piecewise) == (
          Piecewise((1, x + 10 >= 0), (0, True))
      )
      assert SingularityFunction(x, 2, -1).rewrite(Piecewise) == (
          Piecewise((oo, Eq(x - 2, 0)), (0, True))
      )
      assert SingularityFunction(x, 0, -2).rewrite(Piecewise) == (
          Piecewise((oo, Eq(x, 0)), (0, True))
      )
  
      n = Symbol("n", nonnegative=True)
      p = SingularityFunction(x, a, n).rewrite(Piecewise)
      assert p == (Piecewise(((x - a) ** n, x - a >= 0), (0, True)))
      assert p.subs(x, a).subs(n, 0) == 1
  
      expr_in = (
          SingularityFunction(x, 4, 5)
          + SingularityFunction(x, -3, -1)
          - SingularityFunction(x, 0, -2)
      )
      expr_out = (
          (x - 4) ** 5 * Heaviside(x - 4, 1)
          + DiracDelta(x + 3)
          - DiracDelta(x, 1)
      )
      assert expr_in.rewrite(Heaviside) == expr_out
      assert expr_in.rewrite(DiracDelta) == expr_out
      assert expr_in.rewrite("HeavisideDiracDelta") == expr_out
  
      expr_in = (
          SingularityFunction(x, a, n)
          + SingularityFunction(x, a, -1)
          - SingularityFunction(x, a, -2)
      )
      expr_out = (
          (x - a) ** n * Heaviside(x - a, 1)
          + DiracDelta(x - a)
          + DiracDelta(a - x, 1)
      )
      assert expr_in.rewrite(Heaviside) == expr_out
      assert expr_in.rewrite(DiracDelta) == expr_out
      assert expr_in.rewrite("HeavisideDiracDelta") == expr_out
  
file_path: sympy/sympy/functions/special/tests/test_singularity_functions.py
imports: from sympy.core.function import Derivative, diff
  from sympy.core.numbers import Float, I, nan, oo, pi
  from sympy.core.relational import Eq
  from sympy.core.symbol import Symbol, symbols
  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.series.order import O
  from sympy.core.expr import unchanged
  from sympy.core.function import ArgumentIndexError
  from sympy.testing.pytest import raises
label_desc: Use image node_id 5 for calling a global function with example usage: test_rewrite() without return types