

def test_contains_contained_lookups(self):
    "Testing the 'contained', 'contains', and 'bbcontains' lookup types."
    texas = Country.objects.get(name='Texas')
    if (not oracle):
        qs = City.objects.filter(point__contained=texas.mpoly)
        self.assertEqual(3, qs.count())
        cities = ['Houston', 'Dallas', 'Oklahoma City']
        for c in qs:
            self.assertEqual(True, (c.name in cities))
    houston = City.objects.get(name='Houston')
    wellington = City.objects.get(name='Wellington')
    pueblo = City.objects.get(name='Pueblo')
    okcity = City.objects.get(name='Oklahoma City')
    lawrence = City.objects.get(name='Lawrence')
    tx = Country.objects.get(mpoly__contains=houston.point)
    nz = Country.objects.get(mpoly__contains=wellington.point.hex)
    self.assertEqual('Texas', tx.name)
    self.assertEqual('New Zealand', nz.name)
    if (not spatialite):
        ks = State.objects.get(poly__contains=lawrence.point)
        self.assertEqual('Kansas', ks.name)
    self.assertEqual(0, len(Country.objects.filter(mpoly__contains=pueblo.point)))
    self.assertEqual(((mysql and 1) or 0), len(Country.objects.filter(mpoly__contains=okcity.point.wkt)))
    if (not oracle):
        qs = Country.objects.filter(mpoly__bbcontains=okcity.point)
        self.assertEqual(1, len(qs))
        self.assertEqual('Texas', qs[0].name)

dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/contrib/gis/tests/geoapp/tests.py GeoLookupTest.test_contains_contained_lookups/original