mirror of
https://github.com/django/django.git
synced 2025-12-04 00:55:36 +00:00
Fixed #27830 -- Used distutils.version.LooseVersion for version parsing.
This commit is contained in:
parent
e7dc39fb65
commit
08bda82c23
10 changed files with 52 additions and 45 deletions
|
|
@ -68,6 +68,12 @@ class TestPostGISVersionCheck(unittest.TestCase):
|
|||
actual = ops.postgis_version_tuple()
|
||||
self.assertEqual(expect, actual)
|
||||
|
||||
def test_version_loose_tuple(self):
|
||||
expect = ('1.2.3b1.dev0', 1, 2, 3)
|
||||
ops = FakePostGISOperations(expect[0])
|
||||
actual = ops.postgis_version_tuple()
|
||||
self.assertEqual(expect, actual)
|
||||
|
||||
def test_valid_version_numbers(self):
|
||||
versions = [
|
||||
('1.3.0', 1, 3, 0),
|
||||
|
|
@ -81,15 +87,6 @@ class TestPostGISVersionCheck(unittest.TestCase):
|
|||
actual = ops.spatial_version
|
||||
self.assertEqual(version[1:], actual)
|
||||
|
||||
def test_invalid_version_numbers(self):
|
||||
versions = ['nope', '123']
|
||||
|
||||
for version in versions:
|
||||
with self.subTest(version=version):
|
||||
ops = FakePostGISOperations(version)
|
||||
with self.assertRaises(Exception):
|
||||
ops.spatial_version
|
||||
|
||||
def test_no_version_number(self):
|
||||
ops = FakePostGISOperations()
|
||||
with self.assertRaises(ImproperlyConfigured):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue