code: def test_file_field(app, client):
      @app.post("/")
      @app.input(Files, location="files")
      def index(files_data):
          data = {}
          if "image" in files_data and isinstance(
              files_data["image"], FileStorage
          ):
              data["image"] = True
          return data
  
      rv = client.get("/openapi.json")
      assert rv.status_code == 200
      assert (
          "image"
          in rv.json["components"]["schemas"]["Files"]["properties"]
      )
      assert (
          rv.json["components"]["schemas"]["Files"]["properties"][
              "image"
          ]["type"]
          == "string"
      )
      assert (
          rv.json["components"]["schemas"]["Files"]["properties"][
              "image"
          ]["format"]
          == "binary"
      )
  
      rv = client.post(
          "/",
          data={
              "image": (io.BytesIO(b"test"), "test.jpg"),
          },
          content_type="multipart/form-data",
      )
      assert rv.status_code == 200
      assert rv.json == {"image": True}
  
      rv = client.post(
          "/",
          data={
              "image": "test",
          },
          content_type="multipart/form-data",
      )
      assert rv.status_code == 422
      assert rv.json["detail"]["files"]["image"] == [
          "Not a valid file."
      ]
  
file_path: apiflask/tests/test_fields.py
imports: import io
  import pytest
  from werkzeug.datastructures import FileStorage
  from .schemas import Files
  from .schemas import FilesList
  from apiflask import Schema
  from apiflask.fields import Config
label_desc: Use image node_id 1 for calling a global function with example usage: test_file_field(app, client) and returns: data