code: def test_rcode_Piecewise():
      expr = Piecewise((x, x < 1), (x**2, True))
      res = rcode(expr)
      ref = "ifelse(x < 1,x,x^2)"
      assert res == ref
      tau = Symbol("tau")
      res = rcode(expr, tau)
      ref = "tau = ifelse(x < 1,x,x^2);"
      assert res == ref
  
      expr = 2 * Piecewise((x, x < 1), (x**2, x < 2), (x**3, True))
      assert rcode(expr) == "2*ifelse(x < 1,x,ifelse(x < 2,x^2,x^3))"
      res = rcode(expr, assign_to="c")
      assert res == "c = 2*ifelse(x < 1,x,ifelse(x < 2,x^2,x^3));"
  
      # Check that Piecewise without a True (default) condition error
      # expr = Piecewise((x, x < 1), (x**2, x > 1), (sin(x), x > 0))
      # raises(ValueError, lambda: rcode(expr))
      expr = 2 * Piecewise((x, x < 1), (x**2, x < 2))
      assert (rcode(expr)) == "2*ifelse(x < 1,x,ifelse(x < 2,x^2,NA))"
  
imports: from sympy.core import S, pi, oo, Symbol, symbols, Rational, Integer, GoldenRatio, EulerGamma, Catalan, Lambda, Dummy
  from sympy.functions import Piecewise, sin, cos, Abs, exp, ceiling, sqrt, gamma, sign, Max, Min, factorial, beta
  from sympy.core.relational import Eq, Ge, Gt, Le, Lt, Ne
  from sympy.sets import Range
  from sympy.logic import ITE
  from sympy.codegen import For, aug_assign, Assignment
  from sympy.testing.pytest import raises
  from sympy.printing.rcode import RCodePrinter
  from sympy.utilities.lambdify import implemented_function
  from sympy.tensor import IndexedBase, Idx
  from sympy.matrices import Matrix, MatrixSymbol
  from sympy.printing.rcode import rcode
label_desc: Use image node_id 15 for calling a global function with example usage: test_rcode_Piecewise() without return types