code: def test_app_tearing_down_with_handled_exception_by_app_handler(
      app, client
  ):
      app.config["PROPAGATE_EXCEPTIONS"] = True
      cleanup_stuff = []
  
      @app.teardown_appcontext
      def cleanup(exception):
          cleanup_stuff.append(exception)
  
      @app.route("/")
      def index():
          raise Exception("dummy")
  
      @app.errorhandler(Exception)
      def handler(f):
          return flask.jsonify(str(f))
  
      with app.app_context():
          client.get("/")
  
      assert cleanup_stuff == [None]
  
file_path: flask/tests/test_appctx.py
imports: import pytest
  import flask
  from flask.globals import app_ctx
  from flask.globals import request_ctx
label_desc: Use image node_id 9 for calling a global function with example usage: test_app_tearing_down_with_handled_exception_by_app_handler(app, client) and returns: flask