Added a GeoDjango test with a raw query (Refs #17448)

Thanks David Eklund for the initial patch.
This commit is contained in:
Claude Paroz 2012-08-25 10:52:57 +02:00
parent b7c3b044fc
commit d7a2e816a1
1 changed files with 7 additions and 0 deletions

View File

@ -186,6 +186,13 @@ class GeoModelTest(TestCase):
self.assertEqual(1, qs.count()) self.assertEqual(1, qs.count())
for pc in qs: self.assertEqual(32128, pc.point.srid) for pc in qs: self.assertEqual(32128, pc.point.srid)
def test_raw_sql_query(self):
"Testing raw SQL query."
cities1 = City.objects.all()
cities2 = City.objects.raw('select * from geoapp_city')
self.assertEqual(len(cities1), len(list(cities2)))
self.assertTrue(isinstance(cities2[0].point, Point))
class GeoLookupTest(TestCase): class GeoLookupTest(TestCase):