diff options
author | Simon Charette <charette.s@gmail.com> | 2016-05-24 15:25:05 -0400 |
---|---|---|
committer | Simon Charette <charette.s@gmail.com> | 2017-06-21 00:03:31 -0400 |
commit | 3b429c96736b8328c40e5d77282b0d30de563c3c (patch) | |
tree | df8c5c649cdd24d1d410133d0b0abf638b6876ea /tests/indexes | |
parent | ea91ad4c131816fd0ea8d5f1bfb21b7abd82b47e (diff) | |
download | django-3b429c96736b8328c40e5d77282b0d30de563c3c.tar.gz |
Refs #25530 -- Tracked references of deferred SQL statements.
Diffstat (limited to 'tests/indexes')
-rw-r--r-- | tests/indexes/tests.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/indexes/tests.py b/tests/indexes/tests.py index c2d76feeb9..ee2cbd1564 100644 --- a/tests/indexes/tests.py +++ b/tests/indexes/tests.py @@ -51,7 +51,7 @@ class SchemaIndexesTests(TestCase): def test_index_together(self): editor = connection.schema_editor() - index_sql = editor._model_indexes_sql(Article) + index_sql = [str(statement) for statement in editor._model_indexes_sql(Article)] self.assertEqual(len(index_sql), 1) # Ensure the index name is properly quoted self.assertIn( @@ -70,7 +70,7 @@ class SchemaIndexesTests(TestCase): def test_postgresql_text_indexes(self): """Test creation of PostgreSQL-specific text indexes (#12234)""" from .models import IndexedArticle - index_sql = connection.schema_editor()._model_indexes_sql(IndexedArticle) + index_sql = [str(statement) for statement in connection.schema_editor()._model_indexes_sql(IndexedArticle)] self.assertEqual(len(index_sql), 5) self.assertIn('("headline" varchar_pattern_ops)', index_sql[1]) self.assertIn('("body" text_pattern_ops)', index_sql[3]) @@ -99,7 +99,7 @@ class SchemaIndexesMySQLTests(TransactionTestCase): ) if storage != "InnoDB": self.skip("This test only applies to the InnoDB storage engine") - index_sql = connection.schema_editor()._model_indexes_sql(ArticleTranslation) + index_sql = [str(statement) for statement in connection.schema_editor()._model_indexes_sql(ArticleTranslation)] self.assertEqual(index_sql, [ 'CREATE INDEX `indexes_articletranslation_article_no_constraint_id_d6c0806b` ' 'ON `indexes_articletranslation` (`article_no_constraint_id`)' @@ -114,7 +114,7 @@ class SchemaIndexesMySQLTests(TransactionTestCase): new_field.set_attributes_from_name('new_foreign_key') editor.add_field(ArticleTranslation, new_field) field_created = True - self.assertEqual(editor.deferred_sql, [ + self.assertEqual([str(statement) for statement in editor.deferred_sql], [ 'ALTER TABLE `indexes_articletranslation` ' 'ADD CONSTRAINT `indexes_articletrans_new_foreign_key_id_d27a9146_fk_indexes_a` ' 'FOREIGN KEY (`new_foreign_key_id`) REFERENCES `indexes_article` (`id`)' |