docstr: Test if the exception is logged with rich enabled and disabled.
docstr_tok: ["Test","if","the","exception","is","logged","with","rich","enabled","and","disabled","."]
code: def test_handle_uncaught_app_exception_with_rich(self):
      """Test if the exception is logged with rich enabled and disabled."""
      exc = Exception("boom!")
      with testutil.patch_config_options({"logger.enableRich": True}):
          with io.StringIO() as buf:
              # Capture stdout logs (rich logs to stdout)
              with contextlib.redirect_stdout(buf):
                  handle_uncaught_app_exception(exc)
              # Capture the stdout output
              captured_output = buf.getvalue()
  
              assert "Exception:" in captured_output
              assert "boom!" in captured_output
              # Uncaught app exception is only used by the non-rich exception logging
              assert "Uncaught app exception" not in captured_output
      with testutil.patch_config_options({"logger.enableRich": False}):
          with io.StringIO() as buf:
              # Capture stdout logs
              with contextlib.redirect_stdout(buf):
                  handle_uncaught_app_exception(exc)
              # Capture the stdout output
              captured_output = buf.getvalue()
  
              # With rich deactivated, the exception is not logged to stdout
              assert "Exception:" not in captured_output
              assert "boom!" not in captured_output
  
file_path: streamlit/lib/tests/streamlit/error_util_test.py
imports: import contextlib
  import io
  import unittest
  from unittest.mock import patch
  from streamlit.error_util import _print_rich_exception, handle_uncaught_app_exception
  from tests import testutil
label_desc: Use image node_id 4 for calling the ErrorUtilTest obj's underlying member method code with example usage: obj.test_handle_uncaught_app_exception_with_rich() without return types