code: def test_scriptinfo(test_apps, monkeypatch):
      obj = ScriptInfo(app_import_path="cliapp.app:testapp")
      app = obj.load_app()
      assert app.name == "testapp"
      assert obj.load_app() is app
  
      # import app with module's absolute path
      cli_app_path = str(test_path / "cliapp" / "app.py")
  
      obj = ScriptInfo(app_import_path=cli_app_path)
      app = obj.load_app()
      assert app.name == "testapp"
      assert obj.load_app() is app
      obj = ScriptInfo(app_import_path=f"{cli_app_path}:testapp")
      app = obj.load_app()
      assert app.name == "testapp"
      assert obj.load_app() is app
  
      def create_app():
          return Flask("createapp")
  
      obj = ScriptInfo(create_app=create_app)
      app = obj.load_app()
      assert app.name == "createapp"
      assert obj.load_app() is app
  
      obj = ScriptInfo()
      pytest.raises(NoAppException, obj.load_app)
  
      # import app from wsgi.py in current directory
      monkeypatch.chdir(test_path / "helloworld")
      obj = ScriptInfo()
      app = obj.load_app()
      assert app.name == "hello"
  
      # import app from app.py in current directory
      monkeypatch.chdir(test_path / "cliapp")
      obj = ScriptInfo()
      app = obj.load_app()
      assert app.name == "testapp"
  
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 9 for calling a global function with example usage: test_scriptinfo(test_apps, monkeypatch) and returns: Flask