Permalink
Browse files

Fixed #15216 -- Made return type of an internal DB introspection meth…

…od consistent.

Thanks arthur AT milliways DOT fr for the report and patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17510 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent a411242 commit 98b4572ef7fee55d4ec92705cf45770a1318c10b @ramiro ramiro committed Feb 11, 2012
Showing with 12 additions and 0 deletions.
  1. +1 −0 django/db/backends/__init__.py
  2. +11 −0 tests/regressiontests/introspection/tests.py
@@ -905,6 +905,7 @@ def django_table_names(self, only_existing=False):
continue
tables.add(model._meta.db_table)
tables.update([f.m2m_db_table() for f in model._meta.local_many_to_many])
+ tables = list(tables)
if only_existing:
existing_tables = self.table_names()
tables = [
@@ -53,6 +53,17 @@ def test_django_table_names(self):
self.assertTrue('django_ixn_testcase_table' not in tl,
"django_table_names() returned a non-Django table")
+ def test_django_table_names_retval_type(self):
+ # Ticket #15216
+ cursor = connection.cursor()
+ cursor.execute('CREATE TABLE django_ixn_test_table (id INTEGER);')
+
+ tl = connection.introspection.django_table_names(only_existing=True)
+ self.assertIs(type(tl), list)
+
+ tl = connection.introspection.django_table_names(only_existing=False)
+ self.assertIs(type(tl), list)
+
def test_installed_models(self):
tables = [Article._meta.db_table, Reporter._meta.db_table]
models = connection.introspection.installed_models(tables)

0 comments on commit 98b4572

Please sign in to comment.