          self.assertEqual(3, Point2D.objects.count())
  
          # The city shapefile is 2D, and won't be able to fill the coordinates
          # in the 3D model -- thus, a LayerMapError is raised.
          self.assertRaises(LayerMapError, LayerMapping,
                            Point3D, city_file, point_mapping, transform=False)
  
          # 3D model should take 3D data just fine.
          lm = LayerMapping(Point3D, vrt_file, point_mapping, transform=False)
          lm.save()
          self.assertEqual(3, Point3D.objects.count())
 
</s> remove         self.assertRaises(TypeError, LayerMapping, County, co_shp, bad_fk_map1, transform=False)
        self.assertRaises(LayerMapError, LayerMapping, County, co_shp, bad_fk_map2, transform=False)
 </s> add         with self.assertRaises(TypeError):
            LayerMapping(County, co_shp, bad_fk_map1, transform=False)
        with self.assertRaises(LayerMapError):
            LayerMapping(County, co_shp, bad_fk_map2, transform=False) </s> remove             self.assertRaises(LayerMapError, LayerMapping, County, co_shp, co_mapping)
 </s> add             with self.assertRaises(LayerMapError):
                LayerMapping(County, co_shp, co_mapping) </s> remove         self.assertRaises(LayerMapError, lm.save, fid_range=fr, step=10)
 </s> add         with self.assertRaises(LayerMapError):
            lm.save(fid_range=fr, step=10) </s> remove         self.assertRaises(
            DatabaseError,
            self.column_classes, LocalBookWithM2M._meta.get_field("tags").remote_field.through
        )
 </s> add         with self.assertRaises(DatabaseError):
            self.column_classes(LocalBookWithM2M._meta.get_field("tags").remote_field.through) </s> remove         self.assertRaises(MissingForeignKey, lm.save, silent=True, strict=True)
 </s> add         with self.assertRaises(MissingForeignKey):
            lm.save(silent=True, strict=True)
        with self.assertRaises(LayerMapError):
            LayerMapping(Point3D, city_file, point_mapping, transform=False)
          self.assertEqual(3, Point2D.objects.count())
  
          # The city shapefile is 2D, and won't be able to fill the coordinates
          # in the 3D model -- thus, a LayerMapError is raised.
        with self.assertRaises(LayerMapError):
            LayerMapping(Point3D, city_file, point_mapping, transform=False)
        with self.assertRaises(LayerMapError):
            LayerMapping(Point3D, city_file, point_mapping, transform=False)
  
          # 3D model should take 3D data just fine.
          lm = LayerMapping(Point3D, vrt_file, point_mapping, transform=False)
          lm.save()
          self.assertEqual(3, Point3D.objects.count())
keep keep keep keep replace replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/gis_tests/geo3d/tests.py