code: def test_flask_spec_format(app, cli_runner, format, tmp_path):
      local_spec_path = tmp_path / "openapi.json"
  
      @app.get("/")
      def hello():
          pass
  
      stdout_result = cli_runner.invoke(
          spec_command, ["--format", format]
      )
      file_result = cli_runner.invoke(
          spec_command,
          ["--format", format, "--output", str(local_spec_path)],
      )
      if format == "json":
          assert '"title": "APIFlask",' in stdout_result.output
          assert '"title": "APIFlask",' in file_result.output
      elif format.startswith("y"):
          assert "title: APIFlask" in stdout_result.output
          assert "title: APIFlask" in file_result.output
      else:
          assert "Invalid value" in stdout_result.output
          assert "Invalid value" in file_result.output
  
file_path: apiflask/tests/test_commands.py
imports: import json
  import pytest
  from .schemas import Foo
  from apiflask.commands import spec_command
label_desc: Use image node_id 4 for calling a global function with example usage: test_flask_spec_format(app, cli_runner, format, tmp_path) without return types