code: def test_erf():
      assert erf(nan) is nan
  
      assert erf(oo) == 1
      assert erf(-oo) == -1
  
      assert erf(0) is S.Zero
  
      assert erf(I * oo) == oo * I
      assert erf(-I * oo) == -oo * I
  
      assert erf(-2) == -erf(2)
      assert erf(-x * y) == -erf(x * y)
      assert erf(-x - y) == -erf(x + y)
  
      assert erf(erfinv(x)) == x
      assert erf(erfcinv(x)) == 1 - x
      assert erf(erf2inv(0, x)) == x
      assert (
          erf(erf2inv(0, x, evaluate=False)) == x
      )  # To cover code in erf
      assert erf(erf2inv(0, erf(erfcinv(1 - erf(erfinv(x)))))) == x
  
      assert erf(I).is_real is False
      assert erf(0, evaluate=False).is_real
      assert erf(0, evaluate=False).is_zero
  
      assert conjugate(erf(z)) == erf(conjugate(z))
  
      assert erf(x).as_leading_term(x) == 2 * x / sqrt(pi)
      assert erf(x * y).as_leading_term(y) == 2 * x * y / sqrt(pi)
      assert (erf(x * y) / erf(y)).as_leading_term(y) == x
      assert erf(1 / x).as_leading_term(x) == S.One
  
      assert (
          erf(z).rewrite("uppergamma")
          == sqrt(z**2) * (1 - erfc(sqrt(z**2))) / z
      )
      assert erf(z).rewrite("erfc") == S.One - erfc(z)
      assert erf(z).rewrite("erfi") == -I * erfi(I * z)
      assert erf(z).rewrite("fresnels") == (1 + I) * (
          fresnelc(z * (1 - I) / sqrt(pi))
          - I * fresnels(z * (1 - I) / sqrt(pi))
      )
      assert erf(z).rewrite("fresnelc") == (1 + I) * (
          fresnelc(z * (1 - I) / sqrt(pi))
          - I * fresnels(z * (1 - I) / sqrt(pi))
      )
      assert erf(z).rewrite("hyper") == 2 * z * hyper(
          [S.Half], [3 * S.Half], -(z**2)
      ) / sqrt(pi)
      assert erf(z).rewrite("meijerg") == z * meijerg(
          [S.Half], [], [0], [Rational(-1, 2)], z**2
      ) / sqrt(pi)
      assert erf(z).rewrite("expint") == sqrt(z**2) / z - z * expint(
          S.Half, z**2
      ) / sqrt(S.Pi)
  
      assert limit(
          exp(x) * exp(x**2) * (erf(x + 1 / exp(x)) - erf(x)), x, oo
      ) == 2 / sqrt(pi)
      assert limit((1 - erf(z)) * exp(z**2) * z, z, oo) == 1 / sqrt(
          pi
      )
      assert (
          limit((1 - erf(x)) * exp(x**2) * sqrt(pi) * x, x, oo) == 1
      )
      assert (
          limit(
              ((1 - erf(x)) * exp(x**2) * sqrt(pi) * x - 1)
              * 2
              * x**2,
              x,
              oo,
          )
          == -1
      )
      assert limit(erf(x) / x, x, 0) == 2 / sqrt(pi)
      assert (
          limit(x ** (-4) - sqrt(pi) * erf(x**2) / (2 * x**6), x, 0)
          == S(1) / 3
      )
  
      assert erf(x).as_real_imag() == (
          erf(re(x) - I * im(x)) / 2 + erf(re(x) + I * im(x)) / 2,
          -I * (-erf(re(x) - I * im(x)) + erf(re(x) + I * im(x))) / 2,
      )
  
      assert erf(x).as_real_imag(deep=False) == (
          erf(re(x) - I * im(x)) / 2 + erf(re(x) + I * im(x)) / 2,
          -I * (-erf(re(x) - I * im(x)) + erf(re(x) + I * im(x))) / 2,
      )
  
      assert erf(w).as_real_imag() == (erf(w), 0)
      assert erf(w).as_real_imag(deep=False) == (erf(w), 0)
      # issue 13575
      assert erf(I).as_real_imag() == (0, -I * erf(I))
  
      raises(ArgumentIndexError, lambda: erf(x).fdiff(2))
  
      assert erf(x).inverse() == erfinv
  
imports: from sympy.core.function import diff, expand, expand_func
  from sympy.core import EulerGamma
  from sympy.core.numbers import E, Float, I, Rational, nan, oo, pi
  from sympy.core.singleton import S
  from sympy.core.symbol import Symbol, symbols
  from sympy.functions.elementary.complexes import conjugate, im, polar_lift, re
  from sympy.functions.elementary.exponential import exp, exp_polar, log
  from sympy.functions.elementary.hyperbolic import cosh, sinh
  from sympy.functions.elementary.miscellaneous import sqrt
  from sympy.functions.elementary.trigonometric import cos, sin, sinc
  from sympy.functions.special.error_functions import Chi, Ci, E1, Ei, Li, Shi, Si, erf, erf2, erf2inv, erfc, erfcinv, erfi, erfinv, expint, fresnelc, fresnels, li
  from sympy.functions.special.gamma_functions import gamma, uppergamma
  from sympy.functions.special.hyper import hyper, meijerg
  from sympy.integrals.integrals import Integral, integrate
  from sympy.series.gruntz import gruntz
  from sympy.series.limits import limit
  from sympy.series.order import O
  from sympy.core.expr import unchanged
  from sympy.core.function import ArgumentIndexError
  from sympy.functions.special.error_functions import _erfs, _eis
  from sympy.testing.pytest import raises
label_desc: Use image node_id 1 for calling a global function with example usage: test_erf() without return types