Fixed #28392 -- Fixed GIS's WKT regex to match large scientific notation numbers.

Thanks Greg Larmore for report and initial patch.
This commit is contained in:
Sergey Fedoseev 2017-09-11 18:13:02 +05:00 committed by Tim Graham
parent 4844af90fb
commit a0b4ecce57
2 changed files with 4 additions and 1 deletions

View File

@ -8,6 +8,6 @@ wkt_regex = re.compile(r'^(SRID=(?P<srid>\-?\d+);)?'
r'(?P<wkt>'
r'(?P<type>POINT|LINESTRING|LINEARRING|POLYGON|MULTIPOINT|'
r'MULTILINESTRING|MULTIPOLYGON|GEOMETRYCOLLECTION)'
r'[ACEGIMLONPSRUTYZ\d,\.\-\(\) ]+)$',
r'[ACEGIMLONPSRUTYZ\d,\.\-\+\(\) ]+)$',
re.I)
json_regex = re.compile(r'^(\s+)?\{.*}(\s+)?$', re.DOTALL)

View File

@ -1337,6 +1337,9 @@ class GEOSTest(SimpleTestCase, TestDataMixin):
with self.assertRaisesMessage(ValueError, msg):
GEOSGeometry.from_ewkt('SRID=WGS84;POINT(1 1)')
def test_fromstr_scientific_wkt(self):
self.assertEqual(GEOSGeometry('POINT(1.0e-1 1.0e+1)'), Point(.1, 10))
def test_normalize(self):
g = MultiPoint(Point(0, 0), Point(2, 2), Point(1, 1))
self.assertIsNone(g.normalize())