summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/migrations/test_writer.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/migrations/test_writer.py b/tests/migrations/test_writer.py
index cb9ed5d0d5..dc551acc6b 100644
--- a/tests/migrations/test_writer.py
+++ b/tests/migrations/test_writer.py
@@ -340,3 +340,14 @@ class WriterTests(TestCase):
fixed_offset_datetime = datetime.datetime(2014, 1, 1, 1, 1, tzinfo=FixedOffset(180))
self.assertEqual(MigrationWriter.serialize_datetime(fixed_offset_datetime),
"datetime.datetime(2013, 12, 31, 22, 1, tzinfo=utc)")
+
+ def test_deconstruct_class_arguments(self):
+ # Yes, it doesn't make sense to use a class as a default for a
+ # CharField. It does make sense for custom fields though, for example
+ # an enumfield that takes the enum class as an argument.
+ class DeconstructableInstances(object):
+ def deconstruct(self):
+ return ('DeconstructableInstances', [], {})
+
+ string = MigrationWriter.serialize(models.CharField(default=DeconstructableInstances))[0]
+ self.assertEqual(string, "models.CharField(default=migrations.test_writer.DeconstructableInstances)")