code: def test_client_pop_all_preserved(app, req_ctx, client):
      @app.route("/")
      def index():
          # stream_with_context pushes a third context, preserved by response
          return flask.stream_with_context("hello")
  
      # req_ctx fixture pushed an initial context
      with client:
          # request pushes a second request context, preserved by client
          rv = client.get("/")
  
      # close the response, releasing the context held by stream_with_context
      rv.close()
      # only req_ctx fixture should still be pushed
      assert _cv_request.get(None) is req_ctx
  
imports: import importlib.metadata
  import click
  import pytest
  import flask
  from flask import appcontext_popped
  from flask.cli import ScriptInfo
  from flask.globals import _cv_request
  from flask.json import jsonify
  from flask.testing import EnvironBuilder
  from flask.testing import FlaskCliRunner
label_desc: Use image node_id 25 for calling a global function with example usage: test_client_pop_all_preserved(app, req_ctx, client) and returns: flask