summaryrefslogtreecommitdiff
path: root/tests/introspection
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2018-10-21 09:08:05 +0200
committerGitHub <noreply@github.com>2018-10-21 09:08:05 +0200
commit328f5627ddfca3008dc5cf9f7da1ade0157ac74f (patch)
tree15e58dc7074e36934bfb13d401e97009642b1d42 /tests/introspection
parent19126339f307e589f99259ab0176c4367a8055f0 (diff)
downloaddjango-328f5627ddfca3008dc5cf9f7da1ade0157ac74f.tar.gz
Fixed #29870 -- Added DurationField introspection for Oracle and PostgreSQL.
Thanks Tim Graham for the review.
Diffstat (limited to 'tests/introspection')
-rw-r--r--tests/introspection/models.py1
-rw-r--r--tests/introspection/tests.py17
2 files changed, 12 insertions, 6 deletions
diff --git a/tests/introspection/models.py b/tests/introspection/models.py
index 6c5c00a336..3a494037d2 100644
--- a/tests/introspection/models.py
+++ b/tests/introspection/models.py
@@ -24,6 +24,7 @@ class Reporter(models.Model):
facebook_user_id = models.BigIntegerField(null=True)
raw_data = models.BinaryField(null=True)
small_int = models.SmallIntegerField()
+ interval = models.DurationField()
class Meta:
unique_together = ('first_name', 'last_name')
diff --git a/tests/introspection/tests.py b/tests/introspection/tests.py
index ed5556fc20..c61720d12b 100644
--- a/tests/introspection/tests.py
+++ b/tests/introspection/tests.py
@@ -77,11 +77,16 @@ class IntrospectionTests(TransactionTestCase):
desc = connection.introspection.get_table_description(cursor, Reporter._meta.db_table)
self.assertEqual(
[datatype(r[1], r) for r in desc],
- ['AutoField' if connection.features.can_introspect_autofield else 'IntegerField',
- 'CharField', 'CharField', 'CharField',
- 'BigIntegerField' if connection.features.can_introspect_big_integer_field else 'IntegerField',
- 'BinaryField' if connection.features.can_introspect_binary_field else 'TextField',
- 'SmallIntegerField' if connection.features.can_introspect_small_integer_field else 'IntegerField']
+ [
+ 'AutoField' if connection.features.can_introspect_autofield else 'IntegerField',
+ 'CharField',
+ 'CharField',
+ 'CharField',
+ 'BigIntegerField' if connection.features.can_introspect_big_integer_field else 'IntegerField',
+ 'BinaryField' if connection.features.can_introspect_binary_field else 'TextField',
+ 'SmallIntegerField' if connection.features.can_introspect_small_integer_field else 'IntegerField',
+ 'DurationField' if connection.features.can_introspect_duration_field else 'BigIntegerField',
+ ]
)
def test_get_table_description_col_lengths(self):
@@ -98,7 +103,7 @@ class IntrospectionTests(TransactionTestCase):
nullable_by_backend = connection.features.interprets_empty_strings_as_nulls
self.assertEqual(
[r[6] for r in desc],
- [False, nullable_by_backend, nullable_by_backend, nullable_by_backend, True, True, False]
+ [False, nullable_by_backend, nullable_by_backend, nullable_by_backend, True, True, False, False]
)
@skipUnlessDBFeature('can_introspect_autofield')