diff --git a/django/contrib/gis/geos/coordseq.py b/django/contrib/gis/geos/coordseq.py index 15400e08fe..da940e75f8 100644 --- a/django/contrib/gis/geos/coordseq.py +++ b/django/contrib/gis/geos/coordseq.py @@ -70,12 +70,12 @@ class GEOSCoordSeq(GEOSBase): def _checkindex(self, index): "Check the given index." if not (0 <= index < self.size): - raise IndexError("invalid GEOS Geometry index: %s" % index) + raise IndexError("Invalid GEOS Geometry index: %s" % index) def _checkdim(self, dim): "Check the given dimension." if dim < 0 or dim > 2: - raise GEOSException('invalid ordinate dimension "%d"' % dim) + raise GEOSException('Invalid ordinate dimension: "%d"' % dim) def _get_x(self, index): return capi.cs_getx(self.ptr, index, byref(c_double())) diff --git a/django/contrib/gis/geos/geometry.py b/django/contrib/gis/geos/geometry.py index 8bbe2c264a..870a615e4f 100644 --- a/django/contrib/gis/geos/geometry.py +++ b/django/contrib/gis/geos/geometry.py @@ -346,7 +346,7 @@ class GEOSGeometryBase(GEOSBase): two Geometries match the elements in pattern. """ if not isinstance(pattern, str) or len(pattern) > 9: - raise GEOSException("invalid intersection matrix pattern") + raise GEOSException("Invalid intersection matrix pattern.") return capi.geos_relatepattern(self.ptr, other.ptr, force_bytes(pattern)) def touches(self, other): @@ -499,7 +499,9 @@ class GEOSGeometryBase(GEOSBase): # source SRS. srid = None elif srid is None or srid < 0: - raise GEOSException("Calling transform() with no SRID set is not supported") + raise GEOSException( + "Calling transform() with no SRID set is not supported." + ) # Creating an OGR Geometry, which is then transformed. g = gdal.OGRGeometry(self._ogr_ptr(), srid) diff --git a/django/contrib/gis/geos/polygon.py b/django/contrib/gis/geos/polygon.py index 6f76b57005..9e8d30647b 100644 --- a/django/contrib/gis/geos/polygon.py +++ b/django/contrib/gis/geos/polygon.py @@ -103,7 +103,7 @@ class Polygon(GEOSGeometry): param, msg=( "Parameter must be a sequence of LinearRings or objects that can " - "initialize to LinearRings" + "initialize to LinearRings." ), ): "Try to construct a ring from the given parameter." diff --git a/tests/gis_tests/geos_tests/test_coordseq.py b/tests/gis_tests/geos_tests/test_coordseq.py index 507a22d1a0..6888c34824 100644 --- a/tests/gis_tests/geos_tests/test_coordseq.py +++ b/tests/gis_tests/geos_tests/test_coordseq.py @@ -9,7 +9,7 @@ class GEOSCoordSeqTest(SimpleTestCase): with self.subTest(i): self.assertEqual(coord_seq[i], (i, i)) for i in (-3, 10): - msg = "invalid GEOS Geometry index: %s" % i + msg = "Invalid GEOS Geometry index: %s" % i with self.subTest(i): with self.assertRaisesMessage(IndexError, msg): coord_seq[i] diff --git a/tests/gis_tests/geos_tests/test_geos.py b/tests/gis_tests/geos_tests/test_geos.py index b07c7c04b7..33b58df5f0 100644 --- a/tests/gis_tests/geos_tests/test_geos.py +++ b/tests/gis_tests/geos_tests/test_geos.py @@ -651,7 +651,7 @@ class GEOSTest(SimpleTestCase, TestDataMixin): # Testing polygon construction. msg = ( "Parameter must be a sequence of LinearRings or " - "objects that can initialize to LinearRings" + "objects that can initialize to LinearRings." ) with self.assertRaisesMessage(TypeError, msg): Polygon(0, [1, 2, 3]) @@ -776,7 +776,7 @@ class GEOSTest(SimpleTestCase, TestDataMixin): def test_relate_pattern(self): "Testing relate() and relate_pattern()." g = fromstr("POINT (0 0)") - msg = "invalid intersection matrix pattern" + msg = "Invalid intersection matrix pattern." with self.assertRaisesMessage(GEOSException, msg): g.relate_pattern(0, "invalid pattern, yo") for rg in self.geometries.relate_geoms: @@ -1078,7 +1078,7 @@ class GEOSTest(SimpleTestCase, TestDataMixin): # Should only be able to use __setitem__ with LinearRing geometries. msg = ( "Parameter must be a sequence of LinearRings or " - "objects that can initialize to LinearRings" + "objects that can initialize to LinearRings." ) with self.assertRaisesMessage(TypeError, msg): @@ -1309,7 +1309,7 @@ class GEOSTest(SimpleTestCase, TestDataMixin): if isinstance(g, Point): # IndexError is not raised in GEOS 3.8.0. if geos_version_tuple() != (3, 8, 0): - msg = "invalid GEOS Geometry index:" + msg = "Invalid GEOS Geometry index:" with self.assertRaisesMessage(IndexError, msg): g.x elif isinstance(g, Polygon): @@ -1443,7 +1443,7 @@ class GEOSTest(SimpleTestCase, TestDataMixin): """Testing `transform` method (no SRID or negative SRID)""" g = GEOSGeometry("POINT (-104.609 38.255)", srid=None) - msg = "Calling transform() with no SRID set is not supported" + msg = "Calling transform() with no SRID set is not supported." with self.assertRaisesMessage(GEOSException, msg): g.transform(2774)