code: def test_to_file_roundtrip(tmpdir, geodataframe, ogr_driver, engine):
      driver, ext = ogr_driver
      output_file = os.path.join(str(tmpdir), "output_file" + ext)
      write_kwargs = {}
      if driver == "SQLite":
          write_kwargs["spatialite"] = True
  
          # This if statement can be removed once minimal fiona version >= 1.8.20
          if engine == "fiona":
              import fiona
              from packaging.version import Version
  
              if Version(fiona.__version__) < Version("1.8.20"):
                  pytest.skip(
                      "SQLite driver only available from version 1.8.20"
                  )
  
          # If only 3D Points, geometry_type needs to be specified for spatialite at the
          # moment. This if can be removed once the following PR is released:
          # https://github.com/geopandas/pyogrio/pull/223
          if (
              engine == "pyogrio"
              and len(geodataframe == 2)
              and geodataframe.geometry[0] is None
              and geodataframe.geometry[1] is not None
              and geodataframe.geometry[1].has_z
          ):
              write_kwargs["geometry_type"] = "Point Z"
  
      expected_error = _expected_error_on(geodataframe, driver)
      if expected_error:
          with pytest.raises(
              RuntimeError,
              match="Failed to write record|Could not add feature to layer",
          ):
              geodataframe.to_file(
                  output_file,
                  driver=driver,
                  engine=engine,
                  **write_kwargs,
              )
      else:
          geodataframe.to_file(
              output_file, driver=driver, engine=engine, **write_kwargs
          )
  
          reloaded = geopandas.read_file(output_file, engine=engine)
  
          if driver == "GeoJSON" and engine == "pyogrio":
              # For GeoJSON files, the int64 column comes back as int32
              reloaded["a"] = reloaded["a"].astype("int64")
  
          assert_geodataframe_equal(
              geodataframe, reloaded, check_column_type="equiv"
          )
  
file_path: geopandas/geopandas/io/tests/test_file_geom_types_drivers.py
imports: import os
  from shapely.geometry import LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon
  import geopandas
  from geopandas import GeoDataFrame
  from geopandas.testing import assert_geodataframe_equal
  import pytest
  from .test_file import FIONA_MARK, PYOGRIO_MARK
label_desc: Use image node_id 7 for calling a global function with example usage: test_to_file_roundtrip(tmpdir, geodataframe, ogr_driver, engine) without return types