code: def test_append_or_driver_error(tmpdir, testdata_generator, driver):
      """Test if driver supports append mode."""
      if driver == "DGN":
          pytest.xfail("DGN schema has changed")
  
      if driver == "BNA" and GDALVersion.runtime() < GDALVersion(2, 0):
          pytest.skip("BNA driver segfaults with gdal 1.11")
  
      path = str(tmpdir.join(get_temp_filename(driver)))
      schema, crs, records1, records2, _ = testdata_generator(
          driver, range(0, 5), range(5, 10)
      )
  
      # If driver is not able to write, we cannot test append
      if driver in driver_mode_mingdal[
          "w"
      ] and get_gdal_version_num() < calc_gdal_version_num(
          *driver_mode_mingdal["w"][driver]
      ):
          return
  
      # Create test file to append to
      with fiona.open(
          path, "w", driver=driver, crs=crs, schema=schema
      ) as c:
          c.writerecords(records1)
  
      if driver in driver_mode_mingdal[
          "a"
      ] and get_gdal_version_num() < calc_gdal_version_num(
          *driver_mode_mingdal["a"][driver]
      ):
          # Test if DriverError is raised for gdal < driver_mode_mingdal
          with pytest.raises(DriverError):
              with fiona.open(path, "a", driver=driver) as c:
                  c.writerecords(records2)
  
      else:
          # Test if we can append
          with fiona.open(path, "a", driver=driver) as c:
              c.writerecords(records2)
  
          if driver in {"FileGDB", "OpenFileGDB"}:
              open_driver = driver
          else:
              open_driver = None
  
          with fiona.open(path, driver=open_driver) as collection:
              assert collection.driver == driver
              assert len(list(collection)) == len(records1) + len(
                  records2
              )
  
file_path: Fiona/tests/test_drvsupport.py
imports: import logging
  import pytest
  from .conftest import requires_gdal24, get_temp_filename
  from fiona.drvsupport import supported_drivers, driver_mode_mingdal
  import fiona.drvsupport
  from fiona.env import GDALVersion
  from fiona._env import calc_gdal_version_num, get_gdal_version_num
  from fiona.errors import DriverError
label_desc: Use image node_id 4 for calling a global function with example usage: test_append_or_driver_error(tmpdir, testdata_generator, driver) without return types