MCPcopy
hub / github.com/django/django / test05_geometries

Method test05_geometries

tests/gis_tests/gdal_tests/test_ds.py:276–298  ·  view source on GitHub ↗

Testing Geometries from Data Source Features.

(self)

Source from the content-addressed store, hash-verified

274 self.assertIn(fld.name, source.fields)
275
276 def test05_geometries(self):
277 "Testing Geometries from Data Source Features."
278 for source in ds_list:
279 ds = DataSource(source.ds)
280
281 # Incrementing through each layer and feature.
282 for layer in ds:
283 geoms = layer.get_geoms()
284 geos_geoms = layer.get_geoms(geos=True)
285 self.assertEqual(len(geoms), len(geos_geoms))
286 self.assertEqual(len(geoms), len(layer))
287 for feat, geom, geos_geom in zip(layer, geoms, geos_geoms):
288 g = feat.geom
289 self.assertEqual(geom, g)
290 self.assertIsInstance(geos_geom, GEOSGeometry)
291 self.assertEqual(g, geos_geom.ogr)
292 # Making sure we get the right Geometry name & type
293 self.assertEqual(source.geom, g.geom_name)
294 self.assertEqual(source.gtype, g.geom_type)
295
296 # Making sure the SpatialReference is as expected.
297 if hasattr(source, "srs_wkt"):
298 self.assertIsNotNone(re.match(wgs_84_wkt_regex, g.srs.wkt))
299
300 def test06_spatial_filter(self):
301 "Testing the Layer.spatial_filter property."

Callers

nothing calls this directly

Calls 3

DataSourceClass · 0.90
get_geomsMethod · 0.45
matchMethod · 0.45

Tested by

no test coverage detected