MCPcopy
hub / github.com/django/django / test_union

Method test_union

tests/gis_tests/geo3d/tests.py:214–231  ·  view source on GitHub ↗

Testing the Union aggregate of 3D models.

(self)

Source from the content-addressed store, hash-verified

212
213 @skipUnlessDBFeature("supports_3d_functions")
214 def test_union(self):
215 """
216 Testing the Union aggregate of 3D models.
217 """
218 # PostGIS query that returned the reference EWKT for this test:
219 # `SELECT ST_AsText(ST_Union(point)) FROM geo3d_city3d;`
220 self._load_city_data()
221 ref_ewkt = (
222 "SRID=4326;MULTIPOINT(-123.305196 48.462611 15,-104.609252 38.255001 1433,"
223 "-97.521157 34.464642 380,-96.801611 32.782057 147,-95.363151 29.763374 18,"
224 "-95.23506 38.971823 251,-87.650175 41.850385 181,174.783117 -41.315268 14)"
225 )
226 ref_union = GEOSGeometry(ref_ewkt)
227 union = City3D.objects.aggregate(Union("point"))["point__union"]
228 self.assertTrue(union.hasz)
229 # Ordering of points in the resulting geometry may vary between
230 # implementations
231 self.assertEqual({p.ewkt for p in ref_union}, {p.ewkt for p in union})
232
233 @skipUnlessDBFeature("supports_3d_functions")
234 def test_extent(self):

Callers

nothing calls this directly

Calls 4

GEOSGeometryClass · 0.90
UnionClass · 0.90
_load_city_dataMethod · 0.80
aggregateMethod · 0.80

Tested by

no test coverage detected