Ticket #29955: test-29955.diff

File test-29955.diff, 1.4 KB (added by Mariusz Felisiak, 5 years ago)
  • tests/gis_tests/distapp/models.py

    diff --git a/tests/gis_tests/distapp/models.py b/tests/gis_tests/distapp/models.py
    index fcad6fc097..1971741c54 100644
    a b class AustraliaCity(NamedModel):  
    2828    "City model for Australia, using WGS84."
    2929    point = models.PointField()
    3030    radius = models.IntegerField(default=10000)
     31    allowed_distance = models.FloatField(default=0.5)
    3132
    3233
    3334class CensusZipcode(NamedModel):
  • tests/gis_tests/distapp/tests.py

    diff --git a/tests/gis_tests/distapp/tests.py b/tests/gis_tests/distapp/tests.py
    index d84e829868..0c1c992614 100644
    a b class DistanceTest(TestCase):  
    234234        ).filter(annotated_value=True)
    235235        self.assertEqual(self.get_names(qs), ['77002', '77025', '77401'])
    236236
     237    @skipUnlessDBFeature('supports_dwithin_lookup')
     238    def test_dwithin_with_expression_rhs(self):
     239        # LineString of Wollongong and Adelaide coords.
     240        ls = LineString(((150.902, -34.4245), (138.6, -34.9258)), srid=4326)
     241        qs = AustraliaCity.objects.filter(
     242            point__dwithin=(ls, F('allowed_distance')),
     243        ).order_by('name')
     244        self.assertEqual(
     245            self.get_names(qs),
     246            ['Adelaide', 'Mittagong', 'Shellharbour', 'Thirroul', 'Wollongong'],
     247        )
    237248
    238249'''
    239250=============================
Back to Top