code: def test_spec_format(app, client, cli_runner, format):
      app.config["SPEC_FORMAT"] = format
  
      result = cli_runner.invoke(spec_command)
      rv = client.get("/openapi.json")
      assert rv.status_code == 200
      if format == "json":
          assert '"title": "APIFlask",' in result.output
          assert b'"title":"APIFlask",' in rv.data
          assert rv.headers["Content-Type"] == "application/json"
      else:
          assert "title: APIFlask" in result.output
          assert b"title: APIFlask" in rv.data
          assert rv.headers["Content-Type"] == "text/vnd.yaml"
  
file_path: apiflask/tests/test_settings_openapi_spec.py
imports: import json
  import pytest
  from apiflask import APIFlask
  from apiflask.commands import spec_command
label_desc: Use image node_id 3 for calling a global function with example usage: test_spec_format(app, client, cli_runner, format) without return types