diff options
author | Shai Berger <shai@platonix.com> | 2014-09-27 00:18:22 +0300 |
---|---|---|
committer | Shai Berger <shai@platonix.com> | 2014-09-27 09:49:50 +0300 |
commit | c1ae0621bab6b013025ec9024691ce7ad556409e (patch) | |
tree | df1c2d71bae8fe23c00af16715fd3a9ebe332860 /tests/inspectdb/tests.py | |
parent | dbdae3a75512bddbf0b75ea6354fb3fc4bdb53cf (diff) | |
download | django-c1ae0621bab6b013025ec9024691ce7ad556409e.tar.gz |
Fixed #22738 -- made finer distinctions for when Boolean is not detected on Oracle
Thanks Claude Paroz for partial fix and Simon Charrette for review
Diffstat (limited to 'tests/inspectdb/tests.py')
-rw-r--r-- | tests/inspectdb/tests.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/tests/inspectdb/tests.py b/tests/inspectdb/tests.py index 8b187191ae..708bae4fb8 100644 --- a/tests/inspectdb/tests.py +++ b/tests/inspectdb/tests.py @@ -9,6 +9,8 @@ from django.db import connection from django.test import TestCase, skipUnlessDBFeature from django.utils.six import PY3, StringIO +from .models import ColumnTypes + class InspectDBTestCase(TestCase): @@ -87,19 +89,18 @@ class InspectDBTestCase(TestCase): else: assertFieldType('big_int_field', "models.IntegerField()") - if connection.features.introspected_boolean_field_type == 'BooleanField': - assertFieldType('bool_field', "models.BooleanField()") - if connection.features.can_introspect_null: - assertFieldType('null_bool_field', "models.NullBooleanField()") - else: - assertFieldType('null_bool_field', "models.BooleanField()") + bool_field = ColumnTypes._meta.get_field('bool_field') + bool_field_type = connection.features.introspected_boolean_field_type(bool_field) + assertFieldType('bool_field', "models.{}()".format(bool_field_type)) + null_bool_field = ColumnTypes._meta.get_field('null_bool_field') + null_bool_field_type = connection.features.introspected_boolean_field_type(null_bool_field) + if 'BooleanField' in null_bool_field_type: + assertFieldType('null_bool_field', "models.{}()".format(null_bool_field_type)) else: - field_type = connection.features.introspected_boolean_field_type - assertFieldType('bool_field', "models.{}()".format(field_type)) if connection.features.can_introspect_null: - assertFieldType('null_bool_field', "models.{}(blank=True, null=True)".format(field_type)) + assertFieldType('null_bool_field', "models.{}(blank=True, null=True)".format(null_bool_field_type)) else: - assertFieldType('null_bool_field', "models.{}()".format(field_type)) + assertFieldType('null_bool_field', "models.{}()".format(null_bool_field_type)) if connection.features.can_introspect_decimal_field: assertFieldType('decimal_field', "models.DecimalField(max_digits=6, decimal_places=1)") |