code: def test_app_cli_has_app_context(app, runner):
      def _param_cb(ctx, param, value):
          # current_app should be available in parameter callbacks
          return bool(current_app)
  
      @app.cli.command()
      @click.argument("value", callback=_param_cb)
      def check(value):
          app = click.get_current_context().obj.load_app()
          # the loaded app should be the same as current_app
          same_app = current_app._get_current_object() is app
          return same_app, value
  
      cli = FlaskGroup(create_app=lambda: app)
      result = runner.invoke(cli, ["check", "x"], standalone_mode=False)
      assert result.return_value == (True, True)
  
imports: import importlib.metadata
  import os
  import platform
  import ssl
  import sys
  import types
  from functools import partial
  from pathlib import Path
  import click
  import pytest
  from _pytest.monkeypatch import notset
  from click.testing import CliRunner
  from flask import Blueprint
  from flask import current_app
  from flask import Flask
  from flask.cli import AppGroup
  from flask.cli import find_best_app
  from flask.cli import FlaskGroup
  from flask.cli import get_version
  from flask.cli import load_dotenv
  from flask.cli import locate_app
  from flask.cli import NoAppException
  from flask.cli import prepare_import
  from flask.cli import run_command
  from flask.cli import ScriptInfo
  from flask.cli import with_appcontext
label_desc: Use image node_id 10 for calling a global function with example usage: test_app_cli_has_app_context(app, runner) and returns: bool, same_app,  value