summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-01-03 09:49:00 -0500
committerGitHub <noreply@github.com>2017-01-03 09:49:00 -0500
commitc04207cd386e97f57e34791806fd253731295e43 (patch)
tree0b399df4cf35cb3e3e17760173bc884a34e261e0
parentfdb23096040edbd2ec886e4227143b19fe04247a (diff)
Replaced some GIS has_X_method skips with supports_X_aggr/has_X_function.
-rw-r--r--django/contrib/gis/db/backends/base/features.py6
-rw-r--r--tests/gis_tests/distapp/tests.py2
-rw-r--r--tests/gis_tests/geoapp/tests.py2
-rw-r--r--tests/gis_tests/relatedapp/tests.py2
4 files changed, 8 insertions, 4 deletions
diff --git a/django/contrib/gis/db/backends/base/features.py b/django/contrib/gis/db/backends/base/features.py
index 53de204cb9..166495a6cc 100644
--- a/django/contrib/gis/db/backends/base/features.py
+++ b/django/contrib/gis/db/backends/base/features.py
@@ -82,7 +82,7 @@ class BaseSpatialFeatures(object):
'svg', 'sym_difference', 'transform', 'translate', 'union', 'unionagg',
)
- # Specifies whether the Collect and Extent aggregates are supported by the database
+ # Is the aggregate supported by the database?
@property
def supports_collect_aggr(self):
return aggregates.Collect not in self.connection.ops.disallowed_aggregates
@@ -95,6 +95,10 @@ class BaseSpatialFeatures(object):
def supports_make_line_aggr(self):
return aggregates.MakeLine not in self.connection.ops.disallowed_aggregates
+ @property
+ def supports_union_aggr(self):
+ return aggregates.Union not in self.connection.ops.disallowed_aggregates
+
def __init__(self, *args):
super(BaseSpatialFeatures, self).__init__(*args)
for method in self.geoqueryset_methods:
diff --git a/tests/gis_tests/distapp/tests.py b/tests/gis_tests/distapp/tests.py
index 6060f00461..3079afb9d7 100644
--- a/tests/gis_tests/distapp/tests.py
+++ b/tests/gis_tests/distapp/tests.py
@@ -312,7 +312,7 @@ class DistanceTest(TestCase):
# instead (we should get the same results b/c accuracy variance won't matter
# in this test case).
querysets = [qs1]
- if connection.features.has_distance_spheroid_method:
+ if connection.features.has_DistanceSpheroid_function:
gq3 = Q(point__distance_lte=(wollongong.point, d1, 'spheroid'))
gq4 = Q(point__distance_gte=(wollongong.point, d2, 'spheroid'))
qs2 = AustraliaCity.objects.exclude(name='Wollongong').filter(gq3 | gq4)
diff --git a/tests/gis_tests/geoapp/tests.py b/tests/gis_tests/geoapp/tests.py
index 3ec620dc8e..7c4e8b8dfb 100644
--- a/tests/gis_tests/geoapp/tests.py
+++ b/tests/gis_tests/geoapp/tests.py
@@ -864,7 +864,7 @@ class GeoQuerySetTest(TestCase):
self.assertAlmostEqual(c1[0] + xfac, c2[0], 5)
self.assertAlmostEqual(c1[1] + yfac, c2[1], 5)
- @skipUnlessDBFeature("has_unionagg_method")
+ @skipUnlessDBFeature('supports_union_aggr')
def test_unionagg(self):
"""
Testing the `Union` aggregate.
diff --git a/tests/gis_tests/relatedapp/tests.py b/tests/gis_tests/relatedapp/tests.py
index 46796e2c2b..3ca4d91dba 100644
--- a/tests/gis_tests/relatedapp/tests.py
+++ b/tests/gis_tests/relatedapp/tests.py
@@ -98,7 +98,7 @@ class RelatedGeoModelTest(TestCase):
tol
)
- @skipUnlessDBFeature("has_unionagg_method")
+ @skipUnlessDBFeature('supports_union_aggr')
def test_related_union_aggregate(self):
"Testing the `Union` aggregate on related geographic models."
# This combines the Extent and Union aggregates into one query