MCPcopy
hub / github.com/django/django / test_dwithin_subquery

Method test_dwithin_subquery

tests/gis_tests/distapp/tests.py:328–337  ·  view source on GitHub ↗

dwithin lookup in a subquery using OuterRef as a parameter.

(self)

Source from the content-addressed store, hash-verified

326 @skipUnlessGISLookup("dwithin")
327 @skipUnlessDBFeature("has_Transform_function")
328 def test_dwithin_subquery(self):
329 """dwithin lookup in a subquery using OuterRef as a parameter."""
330 qs = CensusZipcode.objects.annotate(
331 annotated_value=Exists(
332 SouthTexasCity.objects.filter(
333 point__dwithin=(OuterRef("poly"), D(m=10)),
334 )
335 )
336 ).filter(annotated_value=True)
337 self.assertEqual(self.get_names(qs), ["77002", "77025", "77401"])
338
339 @skipUnlessGISLookup("dwithin")
340 @skipUnlessDBFeature("supports_dwithin_distance_expr")

Callers

nothing calls this directly

Calls 6

get_namesMethod · 0.95
ExistsClass · 0.90
OuterRefClass · 0.90
annotateMethod · 0.80
DClass · 0.50
filterMethod · 0.45

Tested by

no test coverage detected