code: def test_print_builtin_option():
      # Initialize and setup IPython session
      app = init_ipython_session()
      app.run_cell("ip = get_ipython()")
      app.run_cell("inst = ip.instance()")
      app.run_cell("format = inst.display_formatter.format")
      app.run_cell("from sympy import Symbol")
      app.run_cell("from sympy import init_printing")
  
      app.run_cell("a = format({Symbol('pi'): 3.14, Symbol('n_i'): 3})")
      # Deal with API change starting at IPython 1.0
      if int(ipython.__version__.split(".")[0]) < 1:
          text = app.user_ns["a"]["text/plain"]
          raises(KeyError, lambda: app.user_ns["a"]["text/latex"])
      else:
          text = app.user_ns["a"][0]["text/plain"]
          raises(KeyError, lambda: app.user_ns["a"][0]["text/latex"])
      # XXX: How can we make this ignore the terminal width? This test fails if
      # the terminal is too narrow.
      assert text in (
          "{pi: 3.14, n_i: 3}",
          "{n\N{LATIN SUBSCRIPT SMALL LETTER I}: 3, \N{GREEK SMALL LETTER PI}: 3.14}",
          "{n_i: 3, pi: 3.14}",
          "{\N{GREEK SMALL LETTER PI}: 3.14, n\N{LATIN SUBSCRIPT SMALL LETTER I}: 3}",
      )
  
      # If we enable the default printing, then the dictionary's should render
      # as a LaTeX version of the whole dict: ${\pi: 3.14, n_i: 3}$
      app.run_cell(
          "inst.display_formatter.formatters['text/latex'].enabled = True"
      )
      app.run_cell("init_printing(use_latex=True)")
      app.run_cell("a = format({Symbol('pi'): 3.14, Symbol('n_i'): 3})")
      # Deal with API change starting at IPython 1.0
      if int(ipython.__version__.split(".")[0]) < 1:
          text = app.user_ns["a"]["text/plain"]
          latex = app.user_ns["a"]["text/latex"]
      else:
          text = app.user_ns["a"][0]["text/plain"]
          latex = app.user_ns["a"][0]["text/latex"]
      assert text in (
          "{pi: 3.14, n_i: 3}",
          "{n\N{LATIN SUBSCRIPT SMALL LETTER I}: 3, \N{GREEK SMALL LETTER PI}: 3.14}",
          "{n_i: 3, pi: 3.14}",
          "{\N{GREEK SMALL LETTER PI}: 3.14, n\N{LATIN SUBSCRIPT SMALL LETTER I}: 3}",
      )
      assert (
          latex
          == r"$\displaystyle \left\{ n_{i} : 3, \  \pi : 3.14\right\}$"
      )
  
      # Objects with an _latex overload should also be handled by our tuple
      # printer.
      app.run_cell(
          """\
      class WithOverload:
          def _latex(self, printer):
              return r"\\LaTeX"
      """
      )
      app.run_cell("a = format((WithOverload(),))")
      # Deal with API change starting at IPython 1.0
      if int(ipython.__version__.split(".")[0]) < 1:
          latex = app.user_ns["a"]["text/latex"]
      else:
          latex = app.user_ns["a"][0]["text/latex"]
      assert latex == r"$\displaystyle \left( \LaTeX,\right)$"
  
      app.run_cell(
          "inst.display_formatter.formatters['text/latex'].enabled = True"
      )
      app.run_cell("init_printing(use_latex=True, print_builtin=False)")
      app.run_cell("a = format({Symbol('pi'): 3.14, Symbol('n_i'): 3})")
      # Deal with API change starting at IPython 1.0
      if int(ipython.__version__.split(".")[0]) < 1:
          text = app.user_ns["a"]["text/plain"]
          raises(KeyError, lambda: app.user_ns["a"]["text/latex"])
      else:
          text = app.user_ns["a"][0]["text/plain"]
          raises(KeyError, lambda: app.user_ns["a"][0]["text/latex"])
      # Note : In Python 3 we have one text type: str which holds Unicode data
      # and two byte types bytes and bytearray.
      # Python 3.3.3 + IPython 0.13.2 gives: '{n_i: 3, pi: 3.14}'
      # Python 3.3.3 + IPython 1.1.0 gives: '{n_i: 3, pi: 3.14}'
      assert text in ("{pi: 3.14, n_i: 3}", "{n_i: 3, pi: 3.14}")
  
file_path: sympy/sympy/interactive/tests/test_ipython.py
imports: from sympy.interactive.session import init_ipython_session, enable_automatic_symbols, enable_automatic_int_sympification
  from sympy.core import Symbol, Rational, Integer
  from sympy.external import import_module
  from sympy.testing.pytest import raises
label_desc: Use image node_id 4 for calling a global function with example usage: test_print_builtin_option() without return types