code: def test_json_overwrite_invalid(tmpdir):
      """Overwrite an existing file that isn't a valid GeoJSON"""
  
      # write some invalid data to a file
      path = str(tmpdir.join("foo.json"))
      with open(path, "w") as f:
          f.write("This isn't a valid GeoJSON file!!!")
  
      schema1 = {
          "geometry": "Unknown",
          "properties": [("title", "str")],
      }
      features1 = [
          Feature.from_dict(
              **{
                  "geometry": {
                      "type": "Point",
                      "coordinates": [0.0, 0.0],
                  },
                  "properties": {"title": "One"},
              }
          ),
          Feature.from_dict(
              **{
                  "geometry": {
                      "type": "MultiPoint",
                      "coordinates": [[0.0, 0.0]],
                  },
                  "properties": {"title": "Two"},
              }
          ),
      ]
  
      # attempt to overwrite it with a valid file
      with fiona.open(
          path, "w", driver="GeoJSON", schema=schema1
      ) as dst:
          dst.writerecords(features1)
  
      # test the data was written correctly
      with fiona.open(path, "r") as src:
          assert len(src) == 2
  
file_path: Fiona/tests/test_geojson.py
imports: import json
  import pytest
  import fiona
  from fiona.collection import supported_drivers
  from fiona.errors import FionaValueError, DriverError, SchemaError, CRSError
  from fiona.model import Feature
label_desc: Use image node_id 4 for calling a global function with example usage: test_json_overwrite_invalid(tmpdir) without return types