diff options
| author | Sergey Fedoseev <fedoseev.sergey@gmail.com> | 2017-03-29 22:17:31 +0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-03-29 13:17:31 -0400 |
| commit | 4bc355079c995162354c47d770fa5290470620ca (patch) | |
| tree | ab6e5d19c9317e7bfc40facc18686bf65e64df39 /tests | |
| parent | 9cd6ba991f75bec78a5d34f4a0a765388b2a173b (diff) | |
Fixed #27973 -- Fixed GeoJSON representation of LinearRing and custom GEOSGeometry subclasses.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/gis_tests/geos_tests/test_geos.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/gis_tests/geos_tests/test_geos.py b/tests/gis_tests/geos_tests/test_geos.py index bb3341493c..53e42e4b2f 100644 --- a/tests/gis_tests/geos_tests/test_geos.py +++ b/tests/gis_tests/geos_tests/test_geos.py @@ -372,6 +372,12 @@ class GEOSTest(SimpleTestCase, TestDataMixin): with self.assertRaisesMessage(ValueError, 'LinearRing requires at least 4 points, got 1.'): LinearRing(numpy.array([(0, 0)])) + def test_linearring_json(self): + self.assertJSONEqual( + LinearRing((0, 0), (0, 1), (1, 1), (0, 0)).json, + '{"coordinates": [[0, 0], [0, 1], [1, 1], [0, 0]], "type": "LineString"}', + ) + def test_polygons_from_bbox(self): "Testing `from_bbox` class method." bbox = (-180, -90, 180, 90) @@ -1269,6 +1275,10 @@ class GEOSTest(SimpleTestCase, TestDataMixin): self.assertEqual(type(ext_poly), ExtendedPolygon) # ExtendedPolygon.__str__ should be called (instead of Polygon.__str__). self.assertEqual(str(ext_poly), "EXT_POLYGON - data: 3 - POLYGON ((0 0, 0 1, 1 1, 0 0))") + self.assertJSONEqual( + ext_poly.json, + '{"coordinates": [[[0, 0], [0, 1], [1, 1], [0, 0]]], "type": "Polygon"}', + ) def test_geos_version(self): """Testing the GEOS version regular expression.""" |
