Ticket #12583: patch_12583.diff

File patch_12583.diff, 1.6 KB (added by kwadrat, 13 years ago)
  • tests/regressiontests/backends/tests.py

    diff --git a/tests/regressiontests/backends/tests.py b/tests/regressiontests/backends/tests.py
    index cfb662e..07e0117 100644
    a b from django.db import (backend, connection, connections, DEFAULT_DB_ALIAS,  
    1212    IntegrityError, transaction)
    1313from django.db.backends.signals import connection_created
    1414from django.db.backends.postgresql_psycopg2 import version as pg_version
     15from django.db.backends.postgresql_psycopg2.operations import DatabaseOperations
    1516from django.db.utils import ConnectionHandler, DatabaseError, load_backend
    1617from django.test import TestCase, skipUnlessDBFeature, TransactionTestCase
    1718from django.test.utils import override_settings
    class BackendLoadingTests(TestCase):  
    618619        self.assertRaisesRegexp(ImproperlyConfigured,
    619620            "Try using django.db.backends.sqlite3 instead",
    620621            load_backend, 'sqlite3')
     622
     623
     624class PostgresChecks(unittest.TestCase):
     625    def test_explicit_cast(self):
     626        do = DatabaseOperations(connection=None)
     627        self.assertEqual(do.lookup_cast('iexact'), 'UPPER(%s::text)')
     628        self.assertEqual(do.lookup_cast('contains'), '%s::text')
     629        self.assertEqual(do.lookup_cast('icontains'), 'UPPER(%s::text)')
     630        self.assertEqual(do.lookup_cast('startswith'), '%s::text')
     631        self.assertEqual(do.lookup_cast('istartswith'), 'UPPER(%s::text)')
     632        self.assertEqual(do.lookup_cast('endswith'), '%s::text')
     633        self.assertEqual(do.lookup_cast('iendswith'), 'UPPER(%s::text)')
Back to Top