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

Fixed #23807 -- Ignored non-digits in psycopg2 version

This commit is contained in:
Andriy Sokolovskiy
2014-11-29 16:36:36 +02:00
committed by Tim Graham
parent b8cc5f3cd4
commit 1739ae9edc
2 changed files with 12 additions and 2 deletions

View File

@@ -22,7 +22,7 @@ from django.db.backends.utils import format_number, CursorWrapper
from django.db.models import Sum, Avg, Variance, StdDev
from django.db.models.sql.constants import CURSOR
from django.db.utils import ConnectionHandler
from django.test import (TestCase, TransactionTestCase, override_settings,
from django.test import (TestCase, TransactionTestCase, mock, override_settings,
skipUnlessDBFeature, skipIfDBFeature)
from django.test.utils import str_prefix, IgnoreAllDeprecationWarningsMixin
from django.utils import six
@@ -246,6 +246,16 @@ class PostgreSQLTests(TestCase):
'istartswith', 'endswith', 'iendswith', 'regex', 'iregex'):
self.assertIn('::text', do.lookup_cast(lookup))
def test_correct_extraction_psycopg2_version(self):
from django.db.backends.postgresql_psycopg2.base import DatabaseWrapper
version_path = 'django.db.backends.postgresql_psycopg2.base.Database.__version__'
with mock.patch(version_path, '2.6.9'):
self.assertEqual(DatabaseWrapper.psycopg2_version.__get__(self), (2, 6, 9))
with mock.patch(version_path, '2.5.dev0'):
self.assertEqual(DatabaseWrapper.psycopg2_version.__get__(self), (2, 5))
class DateQuotingTest(TestCase):