MCPcopy
hub / github.com/django/django / test_geoagg_subquery

Method test_geoagg_subquery

tests/gis_tests/geoapp/tests.py:786–801  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

784
785 @skipUnlessDBFeature("supports_union_aggr")
786 def test_geoagg_subquery(self):
787 tx = Country.objects.get(name="Texas")
788 union = GEOSGeometry("MULTIPOINT(-96.801611 32.782057,-95.363151 29.763374)")
789 # Use distinct() to force the usage of a subquery for aggregation.
790 with CaptureQueriesContext(connection) as ctx:
791 self.assertIs(
792 union.equals(
793 City.objects.filter(point__within=tx.mpoly)
794 .distinct()
795 .aggregate(
796 Union("point"),
797 )["point__union"],
798 ),
799 True,
800 )
801 self.assertIn("subquery", ctx.captured_queries[0]["sql"])
802
803 @skipUnlessDBFeature("supports_tolerance_parameter")
804 def test_unionagg_tolerance(self):

Callers

nothing calls this directly

Calls 8

GEOSGeometryClass · 0.90
UnionClass · 0.90
aggregateMethod · 0.80
distinctMethod · 0.80
getMethod · 0.45
equalsMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected