code: def test_write_multilayer_gpkg(tmpdir):
      """
      Test that writing a second layer to an existing geopackage doesn't remove
      and existing layer for the dataset.
      """
      path = str(tmpdir.join("foo.gpkg"))
  
      with fiona.open(
          path,
          "w",
          driver="GPKG",
          schema=example_schema,
          layer="layer1",
          crs=example_crs,
      ) as dst:
          dst.writerecords(example_features[0:2])
  
      with fiona.open(
          path,
          "w",
          driver="GPKG",
          schema=example_schema,
          layer="layer2",
          crs=example_crs,
      ) as dst:
          dst.writerecords(example_features[2:])
  
      with fiona.open(path, layer="layer1") as src:
          assert src.schema["geometry"] == "Point"
          assert len(src) == 2
  
      with fiona.open(path, layer="layer2") as src:
          assert src.schema["geometry"] == "Point"
          assert len(src) == 1
  
file_path: Fiona/tests/test_geopackage.py
imports: import os
  import pytest
  import fiona
  from fiona.model import Feature
  from .conftest import requires_gpkg
label_desc: Use image node_id 3 for calling a global function with example usage: test_write_multilayer_gpkg(tmpdir) without return types