code: def test_model_info(tmpdir: "Path"):
      start = datetime.now(timezone.utc)
      modelinfo_a = ModelInfo(
          tag=Tag("tag"),
          module="module",
          api_version="v1",
          labels={},
          options=ModelOptions(
              option_a=42, option_b="foo", option_c=[0.1, 0.2]
          ),
          metadata={},
          context=TEST_MODEL_CONTEXT,
          signatures={"predict": {"batchable": True}},
      )
      end = datetime.now(timezone.utc)
  
      assert modelinfo_a.context.bentoml_version == BENTOML_VERSION
      assert modelinfo_a.context.python_version == TEST_PYTHON_VERSION
      assert start <= modelinfo_a.creation_time <= end
  
      tag = Tag("test", "v1")
      module = __name__
      labels = {"label": "stringvalue"}
      options = ModelOptions(
          option_a=1, option_b="foo", option_c=[0.1, 0.2]
      )
      metadata = {
          "a": 0.1,
          "b": 1,
          "c": np.array([2, 3, 4], dtype=np.uint32),
      }
      # TODO: add test cases for input_spec and output_spec
      signatures = {
          "predict": {"batchable": False},
          "classify": {"batchable": True, "batch_dim": (0, 0)},
          "predict_ii": {"batchable": True, "batch_dim": (0, 3)},
          "classify_ii": {"batchable": True, "batch_dim": (1, 3)},
      }
  
      modelinfo_b = ModelInfo(
          tag=tag,
          module=module,
          api_version="v1",
          labels=labels,
          options=options,
          metadata=metadata,
          context=TEST_MODEL_CONTEXT,
          signatures=signatures,
      )
  
      model_yaml_b_filename = os.path.join(tmpdir, "b_dump.yml")
      with open(
          model_yaml_b_filename, "w", encoding="utf-8"
      ) as model_yaml_b:
          modelinfo_b.dump(model_yaml_b)
  
      with open(
          model_yaml_b_filename, encoding="utf-8"
      ) as model_yaml_b:
          assert model_yaml_b.read() == expected_yaml.format(
              bentoml_version=BENTOML_VERSION,
              creation_time=modelinfo_b.creation_time.isoformat(),
              python_version=TEST_PYTHON_VERSION,
          )
  
      with open(
          model_yaml_b_filename, encoding="utf-8"
      ) as model_yaml_b:
          modelinfo_b_from_yaml = ModelInfo.from_yaml_file(model_yaml_b)
          assert modelinfo_b_from_yaml == modelinfo_b
  
      # attempt to test that serialization is deterministic
      det_check_filename = os.path.join(tmpdir, "det_check.yml")
      with open(
          det_check_filename, "a+", encoding="utf-8"
      ) as det_check_yaml:
          modelinfo_b.dump(det_check_yaml)
          old_info = det_check_yaml.read()
  
          # re-flush
          modelinfo_b.dump(det_check_yaml)
          assert det_check_yaml.read() == old_info
  
imports: from __future__ import annotations
  import os
  from datetime import datetime
  from datetime import timezone
  from sys import version_info
  from typing import TYPE_CHECKING
  import attr
  import fs
  import fs.errors
  import numpy
  import pytest
  from bentoml import Tag
  from bentoml._internal.configuration import BENTOML_VERSION
  from bentoml._internal.models import ModelOptions
  from bentoml._internal.models.model import Model
  from bentoml._internal.models.model import ModelInfo
  from bentoml._internal.models.model import ModelStore
  from bentoml.exceptions import BentoMLException
  from bentoml.testing.pytest import TEST_MODEL_CONTEXT
label_desc: Use image node_id 1 for calling a global function with example usage: test_model_info(tmpdir) without return types