From b287676739849aae397969aef4e0e09e88cf8bdb Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Fri, 19 Sep 2014 10:03:38 -0400 Subject: [PATCH] [1.7.x] Made a GIS test work on Oracle. Thanks Josh Smeaton and Claude Paroz for advice. Backport of 7add30df01 from master --- django/contrib/gis/tests/geoapp/tests.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/django/contrib/gis/tests/geoapp/tests.py b/django/contrib/gis/tests/geoapp/tests.py index 8456ca1718..97d395af4c 100644 --- a/django/contrib/gis/tests/geoapp/tests.py +++ b/django/contrib/gis/tests/geoapp/tests.py @@ -198,8 +198,10 @@ class GeoModelTest(TestCase): cities1 = City.objects.all() # Only PostGIS would support a 'select *' query because of its recognized # HEXEWKB format for geometry fields - as_text = 'ST_AsText' if postgis else 'asText' - cities2 = City.objects.raw('select id, name, %s(point) from geoapp_city' % as_text) + as_text = 'ST_AsText(%s)' if postgis else connection.ops.select + cities2 = City.objects.raw( + 'select id, name, %s from geoapp_city' % as_text % 'point' + ) self.assertEqual(len(cities1), len(list(cities2))) self.assertTrue(isinstance(cities2[0].point, Point))