diff options
| author | Tim Graham <timograham@gmail.com> | 2017-02-15 13:33:55 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-02-15 20:15:02 -0500 |
| commit | b008f7cc5655d01817a8825e6317877b43c92181 (patch) | |
| tree | 4e70b2dbab77c2dee5e6fdc43c87535c52126740 /tests/postgres_tests | |
| parent | a7214f0e84913a27e0b73de89d4c827ef1c53b94 (diff) | |
Fixed #27135 -- Made index introspection return Index.suffix.
Diffstat (limited to 'tests/postgres_tests')
| -rw-r--r-- | tests/postgres_tests/test_indexes.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/postgres_tests/test_indexes.py b/tests/postgres_tests/test_indexes.py index 9298b86e73..db61561200 100644 --- a/tests/postgres_tests/test_indexes.py +++ b/tests/postgres_tests/test_indexes.py @@ -9,6 +9,9 @@ from .models import CharFieldModel, IntegerArrayModel @skipUnlessDBFeature('has_brin_index_support') class BrinIndexTests(PostgreSQLTestCase): + def test_suffix(self): + self.assertEqual(BrinIndex.suffix, 'brin') + def test_repr(self): index = BrinIndex(fields=['title'], pages_per_range=4) another_index = BrinIndex(fields=['title']) @@ -41,6 +44,9 @@ class BrinIndexTests(PostgreSQLTestCase): class GinIndexTests(PostgreSQLTestCase): + def test_suffix(self): + self.assertEqual(GinIndex.suffix, 'gin') + def test_repr(self): index = GinIndex(fields=['title']) self.assertEqual(repr(index), "<GinIndex: fields='title'>") @@ -84,7 +90,7 @@ class SchemaTests(PostgreSQLTestCase): editor.add_index(IntegerArrayModel, index) constraints = self.get_constraints(IntegerArrayModel._meta.db_table) # Check gin index was added - self.assertEqual(constraints[index_name]['type'], 'gin') + self.assertEqual(constraints[index_name]['type'], GinIndex.suffix) # Drop the index with connection.schema_editor() as editor: editor.remove_index(IntegerArrayModel, index) @@ -97,7 +103,7 @@ class SchemaTests(PostgreSQLTestCase): with connection.schema_editor() as editor: editor.add_index(CharFieldModel, index) constraints = self.get_constraints(CharFieldModel._meta.db_table) - self.assertEqual(constraints[index_name]['type'], 'brin') + self.assertEqual(constraints[index_name]['type'], BrinIndex.suffix) self.assertEqual(constraints[index_name]['options'], ['pages_per_range=4']) with connection.schema_editor() as editor: editor.remove_index(CharFieldModel, index) |
