summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorkrishbharadwaj <krishna.bmsce@gmail.com>2016-04-17 00:10:05 +0530
committerTim Graham <timograham@gmail.com>2016-04-16 16:47:04 -0400
commite494b9ffb60215bb303e81049bd67e8aa36a504d (patch)
treeee07f8e3c72ca6916cd3c3e1bd46a5fc1d0c119f /tests
parenta3265af808bdf8fb466545a64608ff42de30f40d (diff)
Fixed #26509 -- Deprecated the contrib.gis.utils.precision_wkt() function.
Diffstat (limited to 'tests')
-rw-r--r--tests/gis_tests/test_wkt.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/gis_tests/test_wkt.py b/tests/gis_tests/test_wkt.py
new file mode 100644
index 0000000000..b9d15e23b1
--- /dev/null
+++ b/tests/gis_tests/test_wkt.py
@@ -0,0 +1,26 @@
+from unittest import skipUnless
+
+from django.contrib.gis.geos import HAS_GEOS, GEOSGeometry
+from django.contrib.gis.utils.wkt import precision_wkt
+from django.test import SimpleTestCase, ignore_warnings
+from django.utils.deprecation import RemovedInDjango20Warning
+
+
+@skipUnless(HAS_GEOS, "Requires GEOS support")
+class WktTest(SimpleTestCase):
+
+ @ignore_warnings(category=RemovedInDjango20Warning)
+ def test_wkt(self):
+ point = GEOSGeometry('POINT (951640.547328465 4219369.26171664)')
+ self.assertEqual('POINT(951640.547328 4219369.261717)', precision_wkt(point, 6))
+ self.assertEqual('POINT(951640.5473 4219369.2617)', precision_wkt(point, '%.4f'))
+
+ multipoint = GEOSGeometry(
+ "SRID=4326;MULTIPOINT((13.18634033203125 14.504356384277344),"
+ "(13.207969665527 14.490966796875),(13.177070617675 14.454917907714))"
+ )
+ self.assertEqual(
+ "MULTIPOINT(13.186340332031 14.504356384277,"
+ "13.207969665527 14.490966796875,13.177070617675 14.454917907714)",
+ precision_wkt(multipoint, 12)
+ )