summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristian von Roques <roques@mti.ag>2016-11-12 17:18:22 -0400
committerTim Graham <timograham@gmail.com>2016-11-12 16:18:22 -0500
commitcbae4d31847d75d889815bfe7c04af035f45e28d (patch)
treea54cb8cbad39f3998e65b221f3aff2fe735cc44c /tests
parentdf3e92a41cd2dc96c3d20842121deb4f9c6b5766 (diff)
Fixed #27448 -- Switched use of functions deprecated in PostGIS 2.2.
Thanks Claude Paroz and Tim Graham for reviews, and Mjumbe Wawatu Poe for the initial regression test.
Diffstat (limited to 'tests')
-rw-r--r--tests/gis_tests/tests.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/gis_tests/tests.py b/tests/gis_tests/tests.py
index 65526d0cb8..59b8fcf7b5 100644
--- a/tests/gis_tests/tests.py
+++ b/tests/gis_tests/tests.py
@@ -94,3 +94,21 @@ class TestPostGISVersionCheck(unittest.TestCase):
ops = FakePostGISOperations()
with self.assertRaises(ImproperlyConfigured):
ops.spatial_version
+
+ def test_version_dependent_funcs(self):
+ """
+ Resolve names of functions renamed and deprecated in PostGIS 2.2.0
+ depending on PostGIS version.
+ Remove when dropping support for PostGIS 2.1.
+ """
+ ops = FakePostGISOperations('2.2.0')
+ self.assertEqual(ops.spatial_function_name('DistanceSphere'), 'ST_DistanceSphere')
+ self.assertEqual(ops.spatial_function_name('DistanceSpheroid'), 'ST_DistanceSpheroid')
+ self.assertEqual(ops.spatial_function_name('LengthSpheroid'), 'ST_LengthSpheroid')
+ self.assertEqual(ops.spatial_function_name('MemSize'), 'ST_MemSize')
+
+ ops = FakePostGISOperations('2.1.0')
+ self.assertEqual(ops.spatial_function_name('DistanceSphere'), 'ST_distance_sphere')
+ self.assertEqual(ops.spatial_function_name('DistanceSpheroid'), 'ST_distance_spheroid')
+ self.assertEqual(ops.spatial_function_name('LengthSpheroid'), 'ST_length_spheroid')
+ self.assertEqual(ops.spatial_function_name('MemSize'), 'ST_mem_size')