1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #27830 -- Used distutils.version.LooseVersion for version parsing.

This commit is contained in:
chillaranand
2017-02-15 21:44:21 +05:30
committed by Tim Graham
parent e7dc39fb65
commit 08bda82c23
10 changed files with 52 additions and 45 deletions

View File

@@ -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):