code: def test_bento_export(tmpdir: "Path", model_store: "ModelStore"):
      working_dir = os.getcwd()
  
      testbento = build_test_bento()
      # Bento build will change working dir to the build_context, this will reset it
      os.chdir(working_dir)
  
      cfg = BentoBuildConfig("bentoa.py:svc")
      bentoa = Bento.create(cfg, build_ctx="./bentoa")
      # Bento build will change working dir to the build_context, this will reset it
      os.chdir(working_dir)
  
      bentoa1 = Bento.create(cfg, build_ctx="./bentoa1")
      # Bento build will change working dir to the build_context, this will reset it
      os.chdir(working_dir)
  
      cfg = BentoBuildConfig("bentob.py:svc")
      bentob = Bento.create(cfg, build_ctx="./bentob")
  
      bento = testbento
      path = os.path.join(tmpdir, "testbento")
      export_path = bento.export(path)
      assert export_path == path + ".bento"
      assert os.path.isfile(export_path)
      imported_bento = Bento.import_from(export_path)
      assert imported_bento.tag == bento.tag
      assert imported_bento.info == bento.info
      del imported_bento
  
      bento = bentoa
      path = os.path.join(tmpdir, "bentoa")
      export_path = bento.export(path)
      assert export_path == path + ".bento"
      assert os.path.isfile(export_path)
      imported_bento = Bento.import_from(export_path)
      assert imported_bento.tag == bento.tag
      assert imported_bento.info == bento.info
      del imported_bento
  
      bento = bentoa1
      path = os.path.join(tmpdir, "bentoa1")
      export_path = bento.export(path)
      assert export_path == path + ".bento"
      assert os.path.isfile(export_path)
      imported_bento = Bento.import_from(export_path)
      assert imported_bento.tag == bento.tag
      assert imported_bento.info == bento.info
      del imported_bento
  
      bento = bentob
      path = os.path.join(tmpdir, "bentob")
      export_path = bento.export(path)
      assert export_path == path + ".bento"
      assert os.path.isfile(export_path)
      imported_bento = Bento.import_from(export_path)
      assert imported_bento.tag == bento.tag
      assert imported_bento.info == bento.info
      del imported_bento
  
      bento = testbento
      path = os.path.join(tmpdir, "testbento.bento")
      export_path = bento.export(path)
      assert export_path == path
      assert os.path.isfile(export_path)
      imported_bento = Bento.import_from(path)
      assert imported_bento.tag == bento.tag
      assert imported_bento.info == bento.info
      del imported_bento
  
      path = os.path.join(tmpdir, "testbento-parent")
      os.mkdir(path)
      export_path = bento.export(path)
      assert export_path == os.path.join(
          path, bento._export_name + ".bento"
      )
      assert os.path.isfile(export_path)
      imported_bento = Bento.import_from(export_path)
      assert imported_bento.tag == bento.tag
      assert imported_bento.info == bento.info
      del imported_bento
  
      path = os.path.join(tmpdir, "testbento-parent-2/")
      with pytest.raises(ValueError):
          export_path = bento.export(path)
  
      path = os.path.join(tmpdir, "bento-dir")
      os.mkdir(path)
      export_path = bento.export(path)
      assert export_path == os.path.join(
          path, bento._export_name + ".bento"
      )
      assert os.path.isfile(export_path)
      imported_bento = Bento.import_from(export_path)
      assert imported_bento.tag == bento.tag
      assert imported_bento.info == bento.info
      del imported_bento
  
      path = "temp://pytest-some-temp"
      export_path = bento.export(path)
      assert export_path.endswith(
          os.path.join(
              "pytest-some-temp", bento._export_name + ".bento"
          )
      )
      # because this is a tempdir, it's cleaned up immediately after creation...
  
      path = "osfs://" + fs.path.join(str(tmpdir), "testbento-by-url")
      export_path = bento.export(path)
      assert export_path == os.path.join(
          tmpdir, "testbento-by-url.bento"
      )
      assert os.path.isfile(export_path)
      imported_bento = Bento.import_from(export_path)
      assert imported_bento.tag == bento.tag
      assert imported_bento.info == bento.info
      del imported_bento
      imported_bento = Bento.import_from(path + ".bento")
      assert imported_bento.tag == bento.tag
      assert imported_bento.info == bento.info
      del imported_bento
  
      path = "osfs://" + fs.path.join(str(tmpdir), "testbento-by-url")
      with pytest.raises(ValueError):
          bento.export(path, subpath="/badsubpath")
  
      path = "zip://" + fs.path.join(str(tmpdir), "testbento.zip")
      export_path = bento.export(path)
      assert export_path == path
      imported_bento = Bento.import_from(export_path)
      assert imported_bento.tag == bento.tag
      assert imported_bento.info == bento.info
      del imported_bento
  
      path = os.path.join(tmpdir, "testbento-gz")
      os.mkdir(path)
      export_path = bento.export(path, output_format="gz")
      assert export_path == os.path.join(
          path, bento._export_name + ".gz"
      )
      assert os.path.isfile(export_path)
      imported_bento = Bento.import_from(export_path)
      assert imported_bento.tag == bento.tag
      assert imported_bento.info == bento.info
      del imported_bento
  
      path = os.path.join(tmpdir, "testbento-gz-1/")
      with pytest.raises(ValueError):
          bento.export(path, output_format="gz")
  
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 fs
  import pytest
  from bentoml import Tag
  from bentoml import bentos
  from bentoml._internal.bento import Bento
  from bentoml._internal.bento.bento import BentoApiInfo
  from bentoml._internal.bento.bento import BentoInfo
  from bentoml._internal.bento.bento import BentoModelInfo
  from bentoml._internal.bento.bento import BentoRunnerInfo
  from bentoml._internal.bento.build_config import BentoBuildConfig
  from bentoml._internal.configuration import BENTOML_VERSION
  from bentoml._internal.models import ModelStore
label_desc: Use image node_id 4 for calling a global function with example usage: test_bento_export(tmpdir, model_store) without return types