From bb51dc902dc760b6fd03b860335fd99f47e2e13d Mon Sep 17 00:00:00 2001 From: Shai Berger Date: Tue, 26 Jan 2016 00:50:46 +0200 Subject: Refs #26112 -- Fixed aggregate GIS test on Oracle. Made sure the test doesn't try to aggregate over MultiPolygonField and made AreaField turn decimals into floats on the way from the DB. Thanks Daniel Wiesmann, Jani Tiainen, and Tim Graham for review and discussion. --- tests/gis_tests/geoapp/test_functions.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/gis_tests/geoapp/test_functions.py b/tests/gis_tests/geoapp/test_functions.py index aeb1007c56..344fa03e61 100644 --- a/tests/gis_tests/geoapp/test_functions.py +++ b/tests/gis_tests/geoapp/test_functions.py @@ -240,7 +240,9 @@ class GISFunctionsTests(TestCase): CountryWebMercator.objects.create(name=c.name, mpoly=c.mpoly) # Test in projected coordinate system qs = CountryWebMercator.objects.annotate(area_sum=Sum(functions.Area('mpoly'))) - for c in qs: + # Some backends (e.g. Oracle) cannot group by multipolygon values, so + # defer such fields in the aggregation query. + for c in qs.defer('mpoly'): result = c.area_sum # If the result is a measure object, get value. if isinstance(result, Area): -- cgit v1.3