Fixed #31292 -- Fixed django.contrib.gis.gdal.gdal_full_version() crash.

This commit is contained in:
Diederik van der Boor 2020-02-23 22:04:18 +01:00 committed by Mariusz Felisiak
parent 975eb42036
commit 84e35f4679
2 changed files with 9 additions and 2 deletions

View File

@ -80,7 +80,7 @@ def gdal_version():
def gdal_full_version():
"Return the full GDAL version information."
return _version_info('')
return _version_info(b'')
version_regex = _lazy_re_compile(r'^(?P<major>\d+)\.(?P<minor>\d+)(\.(?P<subminor>\d+))?')

View File

@ -1,6 +1,8 @@
import unittest
from django.contrib.gis.gdal import GDAL_VERSION, gdal_version
from django.contrib.gis.gdal import (
GDAL_VERSION, gdal_full_version, gdal_version,
)
class GDALTest(unittest.TestCase):
@ -9,3 +11,8 @@ class GDALTest(unittest.TestCase):
self.assertEqual(gdal_version(), ('%s.%s.%s' % GDAL_VERSION).encode())
else:
self.assertIn(b'.', gdal_version())
def test_gdal_full_version(self):
full_version = gdal_full_version()
self.assertIn(gdal_version(), full_version)
self.assertTrue(full_version.startswith(b'GDAL'))