diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/modeltests/expressions/models.py | 2 | ||||
| -rw-r--r-- | tests/regressiontests/backends/tests.py | 7 | ||||
| -rw-r--r-- | tests/regressiontests/introspection/tests.py | 9 | ||||
| -rw-r--r-- | tests/regressiontests/queries/models.py | 3 |
4 files changed, 13 insertions, 8 deletions
diff --git a/tests/modeltests/expressions/models.py b/tests/modeltests/expressions/models.py index d4de5ccee9..27daabad71 100644 --- a/tests/modeltests/expressions/models.py +++ b/tests/modeltests/expressions/models.py @@ -117,6 +117,6 @@ FieldError: Joined field references are not permitted in this query >>> acme.save() Traceback (most recent call last): ... -TypeError: int() argument must be a string or a number, not 'ExpressionNode' +TypeError: int() argument must be a string or a number... """} diff --git a/tests/regressiontests/backends/tests.py b/tests/regressiontests/backends/tests.py index aff27369ad..628fabf04a 100644 --- a/tests/regressiontests/backends/tests.py +++ b/tests/regressiontests/backends/tests.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Unit and doctests for specific database backends. import unittest -from django.db import connection +from django.db import backend, connection from django.db.backends.signals import connection_created from django.conf import settings @@ -11,9 +11,10 @@ class Callproc(unittest.TestCase): # If the backend is Oracle, test that we can call a standard # stored procedure through our cursor wrapper. if settings.DATABASE_ENGINE == 'oracle': + convert_unicode = backend.convert_unicode cursor = connection.cursor() - cursor.callproc('DBMS_SESSION.SET_IDENTIFIER', - ['_django_testing!',]) + cursor.callproc(convert_unicode('DBMS_SESSION.SET_IDENTIFIER'), + [convert_unicode('_django_testing!'),]) return True else: return True diff --git a/tests/regressiontests/introspection/tests.py b/tests/regressiontests/introspection/tests.py index 7072dc8e9e..1454e1e3e5 100644 --- a/tests/regressiontests/introspection/tests.py +++ b/tests/regressiontests/introspection/tests.py @@ -76,7 +76,7 @@ class IntrospectionTests(TestCase): def test_get_table_description_types(self): cursor = connection.cursor() desc = connection.introspection.get_table_description(cursor, Reporter._meta.db_table) - self.assertEqual([datatype(r[1]) for r in desc], + self.assertEqual([datatype(r[1], r) for r in desc], ['IntegerField', 'CharField', 'CharField', 'CharField']) # Regression test for #9991 - 'real' types in postgres @@ -86,7 +86,7 @@ class IntrospectionTests(TestCase): cursor.execute("CREATE TABLE django_ixn_real_test_table (number REAL);") desc = connection.introspection.get_table_description(cursor, 'django_ixn_real_test_table') cursor.execute('DROP TABLE django_ixn_real_test_table;') - self.assertEqual(datatype(desc[0][1]), 'FloatField') + self.assertEqual(datatype(desc[0][1], desc[0]), 'FloatField') def test_get_relations(self): cursor = connection.cursor() @@ -104,9 +104,10 @@ class IntrospectionTests(TestCase): indexes = connection.introspection.get_indexes(cursor, Article._meta.db_table) self.assertEqual(indexes['reporter_id'], {'unique': False, 'primary_key': False}) -def datatype(dbtype): + +def datatype(dbtype, description): """Helper to convert a data type into a string.""" - dt = connection.introspection.data_types_reverse[dbtype] + dt = connection.introspection.get_field_type(dbtype, description) if type(dt) is tuple: return dt[0] else: diff --git a/tests/regressiontests/queries/models.py b/tests/regressiontests/queries/models.py index 0d28926149..cf21d5210b 100644 --- a/tests/regressiontests/queries/models.py +++ b/tests/regressiontests/queries/models.py @@ -67,6 +67,9 @@ class Author(models.Model): num = models.IntegerField(unique=True) extra = models.ForeignKey(ExtraInfo) + class Meta: + ordering = ['name'] + def __unicode__(self): return self.name |
