Refs #24483 -- Added a test for deconstruction of Field.choices

This commit is contained in:
Tim Graham 2015-03-18 08:23:46 -04:00
parent a0c2eb46dd
commit b4a56ed4f5
1 changed files with 7 additions and 0 deletions

View File

@ -69,6 +69,13 @@ class FieldDeconstructionTests(TestCase):
self.assertEqual(args, []) self.assertEqual(args, [])
self.assertEqual(kwargs, {"max_length": 65, "null": True, "blank": True}) self.assertEqual(kwargs, {"max_length": 65, "null": True, "blank": True})
def test_char_field_choices(self):
field = models.CharField(max_length=1, choices=(("A", "One"), ("B", "Two")))
name, path, args, kwargs = field.deconstruct()
self.assertEqual(path, "django.db.models.CharField")
self.assertEqual(args, [])
self.assertEqual(kwargs, {"choices": [("A", "One"), ("B", "Two")], "max_length": 1})
def test_csi_field(self): def test_csi_field(self):
field = models.CommaSeparatedIntegerField(max_length=100) field = models.CommaSeparatedIntegerField(max_length=100)
name, path, args, kwargs = field.deconstruct() name, path, args, kwargs = field.deconstruct()