Checked can_introspect_null feature in a test.

Forward-port of 1238f92c from stable/1.7.x.
This commit is contained in:
Aymeric Augustin 2014-06-06 00:26:40 +02:00
parent 484f3edf1e
commit 5c95a55330
1 changed files with 8 additions and 2 deletions

View File

@ -89,10 +89,16 @@ class InspectDBTestCase(TestCase):
if connection.features.can_introspect_boolean_field: if connection.features.can_introspect_boolean_field:
assertFieldType('bool_field', "models.BooleanField()") assertFieldType('bool_field', "models.BooleanField()")
if connection.features.can_introspect_null:
assertFieldType('null_bool_field', "models.NullBooleanField()") assertFieldType('null_bool_field', "models.NullBooleanField()")
else:
assertFieldType('null_bool_field', "models.BooleanField()")
else: else:
assertFieldType('bool_field', "models.IntegerField()") assertFieldType('bool_field', "models.IntegerField()")
if connection.features.can_introspect_null:
assertFieldType('null_bool_field', "models.IntegerField(blank=True, null=True)") assertFieldType('null_bool_field', "models.IntegerField(blank=True, null=True)")
else:
assertFieldType('null_bool_field', "models.IntegerField()")
if connection.vendor == 'sqlite': if connection.vendor == 'sqlite':
# Guessed arguments on SQLite, see #5014 # Guessed arguments on SQLite, see #5014