code: def test_matplotlib_bad_latex():
      # Initialize and setup IPython session
      app = init_ipython_session()
      app.run_cell("import IPython")
      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 init_printing, Matrix")
      app.run_cell("init_printing(use_latex='matplotlib')")
  
      # The png formatter is not enabled by default in this context
      app.run_cell(
          "inst.display_formatter.formatters['image/png'].enabled = True"
      )
  
      # Make sure no warnings are raised by IPython
      app.run_cell("import warnings")
      # IPython.core.formatters.FormatterWarning was introduced in IPython 2.0
      if int(ipython.__version__.split(".")[0]) < 2:
          app.run_cell("warnings.simplefilter('error')")
      else:
          app.run_cell(
              "warnings.simplefilter('error', IPython.core.formatters.FormatterWarning)"
          )
  
      # This should not raise an exception
      app.run_cell("a = format(Matrix([1, 2, 3]))")
  
      # issue 9799
      app.run_cell("from sympy import Piecewise, Symbol, Eq")
      app.run_cell(
          "x = Symbol('x'); pw = format(Piecewise((1, Eq(x, 0)), (0, True)))"
      )
  
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 6 for calling a global function with example usage: test_matplotlib_bad_latex() without return types