Made a GIS test work on Oracle.

Thanks Josh Smeaton and Claude Paroz for advice.
This commit is contained in:
Tim Graham 2014-09-19 10:03:38 -04:00
parent 9d30412a5a
commit 7add30df01
1 changed files with 4 additions and 2 deletions

View File

@ -196,8 +196,10 @@ class GeoModelTest(TestCase):
cities1 = City.objects.all() cities1 = City.objects.all()
# Only PostGIS would support a 'select *' query because of its recognized # Only PostGIS would support a 'select *' query because of its recognized
# HEXEWKB format for geometry fields # HEXEWKB format for geometry fields
as_text = 'ST_AsText' if postgis else 'asText' as_text = 'ST_AsText(%s)' if postgis else connection.ops.select
cities2 = City.objects.raw('select id, name, %s(point) from geoapp_city' % as_text) cities2 = City.objects.raw(
'select id, name, %s from geoapp_city' % as_text % 'point'
)
self.assertEqual(len(cities1), len(list(cities2))) self.assertEqual(len(cities1), len(list(cities2)))
self.assertIsInstance(cities2[0].point, Point) self.assertIsInstance(cities2[0].point, Point)