diff options
| author | Jernej Kos <jernej@kos.mx> | 2014-12-21 11:21:37 +0100 |
|---|---|---|
| committer | Jernej Kos <jernej@kos.mx> | 2014-12-21 17:31:50 +0100 |
| commit | 7c50e7eeccd4b4581542547f5ddb603bbd62a725 (patch) | |
| tree | 78636e7a5df768eec1a472471409fbd18702a830 /tests/postgres_tests/test_array.py | |
| parent | 07728a2c2c78b030b7de9c6b20ef028f82d6134a (diff) | |
Fixed #24034 -- Don't always overwrite deconstruct path.
Made deconstruct path overwriting for ArrayField conditional,
so it only occurs when the deconstructed field is an instance
of ArrayField itself and not a subclass.
Diffstat (limited to 'tests/postgres_tests/test_array.py')
| -rw-r--r-- | tests/postgres_tests/test_array.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py index 10917153df..5513fb34aa 100644 --- a/tests/postgres_tests/test_array.py +++ b/tests/postgres_tests/test_array.py @@ -10,7 +10,7 @@ from django import forms from django.test import TestCase, override_settings from django.utils import timezone -from .models import IntegerArrayModel, NullableIntegerArrayModel, CharArrayModel, DateTimeArrayModel, NestedIntegerArrayModel +from .models import IntegerArrayModel, NullableIntegerArrayModel, CharArrayModel, DateTimeArrayModel, NestedIntegerArrayModel, ArrayFieldSubclass @unittest.skipUnless(connection.vendor == 'postgresql', 'PostgreSQL required') @@ -228,6 +228,15 @@ class TestMigrations(TestCase): new = ArrayField(*args, **kwargs) self.assertEqual(new.base_field.max_length, field.base_field.max_length) + def test_subclass_deconstruct(self): + field = ArrayField(models.IntegerField()) + name, path, args, kwargs = field.deconstruct() + self.assertEqual(path, 'django.contrib.postgres.fields.ArrayField') + + field = ArrayFieldSubclass() + name, path, args, kwargs = field.deconstruct() + self.assertEqual(path, 'postgres_tests.models.ArrayFieldSubclass') + @override_settings(MIGRATION_MODULES={ "postgres_tests": "postgres_tests.array_default_migrations", }) |
