(self)
| 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): |
nothing calls this directly
no test coverage detected