diff options
| author | Marcelo Galigniana <marcelogaligniana@gmail.com> | 2022-05-13 22:51:12 -0300 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-05-16 06:46:53 +0200 |
| commit | 76af861356eda3b08bc5e15ad1973f980c7604a3 (patch) | |
| tree | 4811b4f55435ac40c7154c50de77b954b6c72c3a /tests | |
| parent | d27e6b233f83c3429f21ff3c250a28ff302637ef (diff) | |
Fixed #27550 -- Allowed GEOSGeometry.normalize() to return a normalized clone.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/gis_tests/geos_tests/test_geos.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/gis_tests/geos_tests/test_geos.py b/tests/gis_tests/geos_tests/test_geos.py index 4754f17c9b..fd3f0b6ebd 100644 --- a/tests/gis_tests/geos_tests/test_geos.py +++ b/tests/gis_tests/geos_tests/test_geos.py @@ -1528,11 +1528,17 @@ class GEOSTest(SimpleTestCase, TestDataMixin): self.assertEqual(GEOSGeometry("POINT(1.0e-1 1.0e+1)"), Point(0.1, 10)) def test_normalize(self): - g = MultiPoint(Point(0, 0), Point(2, 2), Point(1, 1)) - self.assertIsNone(g.normalize()) - self.assertTrue( - g.equals_exact(MultiPoint(Point(2, 2), Point(1, 1), Point(0, 0))) - ) + multipoint = MultiPoint(Point(0, 0), Point(2, 2), Point(1, 1)) + normalized = MultiPoint(Point(2, 2), Point(1, 1), Point(0, 0)) + # Geometry is normalized in-place and nothing is returned. + multipoint_1 = multipoint.clone() + self.assertIsNone(multipoint_1.normalize()) + self.assertEqual(multipoint_1, normalized) + # If the `clone` keyword is set, then the geometry is not modified and + # a normalized clone of the geometry is returned instead. + multipoint_2 = multipoint.normalize(clone=True) + self.assertEqual(multipoint_2, normalized) + self.assertNotEqual(multipoint, normalized) @skipIf(geos_version_tuple() < (3, 8), "GEOS >= 3.8.0 is required") def test_make_valid(self): |
