mirror of https://github.com/django/django.git
Added SpatialFeatures.supports_tolerance_parameter.
This commit is contained in:
parent
3828427f63
commit
371022a20d
|
@ -51,6 +51,9 @@ class BaseSpatialFeatures:
|
||||||
# Can SchemaEditor alter geometry fields?
|
# Can SchemaEditor alter geometry fields?
|
||||||
can_alter_geometry_field = True
|
can_alter_geometry_field = True
|
||||||
|
|
||||||
|
# Do the database functions/aggregates support the tolerance parameter?
|
||||||
|
supports_tolerance_parameter = False
|
||||||
|
|
||||||
# Set of options that AsGeoJSON() doesn't support.
|
# Set of options that AsGeoJSON() doesn't support.
|
||||||
unsupported_geojson_options = {}
|
unsupported_geojson_options = {}
|
||||||
|
|
||||||
|
|
|
@ -10,4 +10,5 @@ class DatabaseFeatures(BaseSpatialFeatures, OracleDatabaseFeatures):
|
||||||
supports_geometry_field_unique_index = False
|
supports_geometry_field_unique_index = False
|
||||||
supports_perimeter_geodetic = True
|
supports_perimeter_geodetic = True
|
||||||
supports_dwithin_distance_expr = False
|
supports_dwithin_distance_expr = False
|
||||||
|
supports_tolerance_parameter = True
|
||||||
unsupported_geojson_options = {'bbox', 'crs', 'precision'}
|
unsupported_geojson_options = {'bbox', 'crs', 'precision'}
|
||||||
|
|
|
@ -432,10 +432,7 @@ class DistanceFunctionsTests(FuncTestMixin, TestCase):
|
||||||
).filter(d=D(m=1))
|
).filter(d=D(m=1))
|
||||||
self.assertTrue(qs.exists())
|
self.assertTrue(qs.exists())
|
||||||
|
|
||||||
@unittest.skipUnless(
|
@skipUnlessDBFeature('supports_tolerance_parameter')
|
||||||
connection.vendor == 'oracle',
|
|
||||||
'Oracle supports tolerance parameter.',
|
|
||||||
)
|
|
||||||
def test_distance_function_tolerance_escaping(self):
|
def test_distance_function_tolerance_escaping(self):
|
||||||
qs = Interstate.objects.annotate(
|
qs = Interstate.objects.annotate(
|
||||||
d=Distance(
|
d=Distance(
|
||||||
|
@ -448,10 +445,7 @@ class DistanceFunctionsTests(FuncTestMixin, TestCase):
|
||||||
with self.assertRaisesMessage(TypeError, msg):
|
with self.assertRaisesMessage(TypeError, msg):
|
||||||
qs.exists()
|
qs.exists()
|
||||||
|
|
||||||
@unittest.skipUnless(
|
@skipUnlessDBFeature('supports_tolerance_parameter')
|
||||||
connection.vendor == 'oracle',
|
|
||||||
'Oracle supports tolerance parameter.',
|
|
||||||
)
|
|
||||||
def test_distance_function_tolerance(self):
|
def test_distance_function_tolerance(self):
|
||||||
# Tolerance is greater than distance.
|
# Tolerance is greater than distance.
|
||||||
qs = Interstate.objects.annotate(
|
qs = Interstate.objects.annotate(
|
||||||
|
|
|
@ -607,10 +607,7 @@ class GeoQuerySetTest(TestCase):
|
||||||
), True)
|
), True)
|
||||||
self.assertIn('subquery', ctx.captured_queries[0]['sql'])
|
self.assertIn('subquery', ctx.captured_queries[0]['sql'])
|
||||||
|
|
||||||
@unittest.skipUnless(
|
@skipUnlessDBFeature('supports_tolerance_parameter')
|
||||||
connection.vendor == 'oracle',
|
|
||||||
'Oracle supports tolerance parameter.',
|
|
||||||
)
|
|
||||||
def test_unionagg_tolerance(self):
|
def test_unionagg_tolerance(self):
|
||||||
City.objects.create(
|
City.objects.create(
|
||||||
point=fromstr('POINT(-96.467222 32.751389)', srid=4326),
|
point=fromstr('POINT(-96.467222 32.751389)', srid=4326),
|
||||||
|
@ -633,10 +630,7 @@ class GeoQuerySetTest(TestCase):
|
||||||
True,
|
True,
|
||||||
)
|
)
|
||||||
|
|
||||||
@unittest.skipUnless(
|
@skipUnlessDBFeature('supports_tolerance_parameter')
|
||||||
connection.vendor == 'oracle',
|
|
||||||
'Oracle supports tolerance parameter.',
|
|
||||||
)
|
|
||||||
def test_unionagg_tolerance_escaping(self):
|
def test_unionagg_tolerance_escaping(self):
|
||||||
tx = Country.objects.get(name='Texas').mpoly
|
tx = Country.objects.get(name='Texas').mpoly
|
||||||
with self.assertRaises(DatabaseError):
|
with self.assertRaises(DatabaseError):
|
||||||
|
|
Loading…
Reference in New Issue