summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSergey Fedoseev <fedoseev.sergey@gmail.com>2017-07-25 14:11:43 +0500
committerTim Graham <timograham@gmail.com>2017-07-26 09:42:02 -0400
commit5ccbcc5bf61c746a1d5ec2b3d2e0dc56c1a63fe0 (patch)
treea8dcb1374b2a0fde03839bb3ed337420967da527 /tests
parentc362228556bedb4a8a3cdaf91b9e456e459ecda1 (diff)
Fixed #28433 -- Made GEOSGeometry.__eq__() work correctly with non-canonical EWKT string.
Diffstat (limited to 'tests')
-rw-r--r--tests/gis_tests/geos_tests/test_geos.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/gis_tests/geos_tests/test_geos.py b/tests/gis_tests/geos_tests/test_geos.py
index 2c94cc165f..35c06a5105 100644
--- a/tests/gis_tests/geos_tests/test_geos.py
+++ b/tests/gis_tests/geos_tests/test_geos.py
@@ -179,6 +179,7 @@ class GEOSTest(SimpleTestCase, TestDataMixin):
ls = fromstr('LINESTRING(0 0, 1 1, 5 5)')
self.assertEqual(ls, ls.wkt)
self.assertNotEqual(p, 'bar')
+ self.assertEqual(p, 'POINT(5.0 23.0)')
# Error shouldn't be raise on equivalence testing with
# an invalid type.
for g in (p, ls):
@@ -1322,6 +1323,24 @@ class GEOSTest(SimpleTestCase, TestDataMixin):
),
)
+ def test_from_ewkt(self):
+ self.assertEqual(GEOSGeometry.from_ewkt('SRID=1;POINT(1 1)'), Point(1, 1, srid=1))
+ self.assertEqual(GEOSGeometry.from_ewkt('POINT(1 1)'), Point(1, 1))
+
+ def test_from_ewkt_empty_string(self):
+ msg = 'Expected WKT but got an empty string.'
+ with self.assertRaisesMessage(ValueError, msg):
+ GEOSGeometry.from_ewkt('')
+ with self.assertRaisesMessage(ValueError, msg):
+ GEOSGeometry.from_ewkt('SRID=1;')
+
+ def test_from_ewkt_invalid_srid(self):
+ msg = 'EWKT has invalid SRID part.'
+ with self.assertRaisesMessage(ValueError, msg):
+ GEOSGeometry.from_ewkt('SRUD=1;POINT(1 1)')
+ with self.assertRaisesMessage(ValueError, msg):
+ GEOSGeometry.from_ewkt('SRID=WGS84;POINT(1 1)')
+
def test_normalize(self):
g = MultiPoint(Point(0, 0), Point(2, 2), Point(1, 1))
self.assertIsNone(g.normalize())