diff options
| author | Claude Paroz <claude@2xlibre.net> | 2014-05-05 20:39:26 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2014-05-06 09:13:07 +0200 |
| commit | da9cf53cb536511a8abaade9f20e1dd8c4a02c7d (patch) | |
| tree | 8422e49d1865b5bc0ac43f43b1fb2a89dc4f8ccf /tests/field_deconstruction | |
| parent | 12474dacef3b85b1115f78aec905cc3079c68fb1 (diff) | |
Fixed #22564 -- Prevented unneeded bytestrings in migrations
In some cases, this could lead to migrations written with Python 2
being incompatible with Python 3.
Thanks Tim Graham for the report and Loïc Bistuer for the advices.
Diffstat (limited to 'tests/field_deconstruction')
| -rw-r--r-- | tests/field_deconstruction/tests.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/field_deconstruction/tests.py b/tests/field_deconstruction/tests.py index 10cf342529..2aaaad988b 100644 --- a/tests/field_deconstruction/tests.py +++ b/tests/field_deconstruction/tests.py @@ -1,6 +1,8 @@ import warnings -from django.test import TestCase, override_settings + from django.db import models +from django.test import TestCase, override_settings +from django.utils import six class FieldDeconstructionTests(TestCase): @@ -15,14 +17,15 @@ class FieldDeconstructionTests(TestCase): # First try using a "normal" field field = models.CharField(max_length=65) name, path, args, kwargs = field.deconstruct() - self.assertEqual(name, None) + self.assertIsNone(name) field.set_attributes_from_name("is_awesome_test") name, path, args, kwargs = field.deconstruct() self.assertEqual(name, "is_awesome_test") + self.assertIsInstance(name, six.text_type) # Now try with a ForeignKey field = models.ForeignKey("some_fake.ModelName") name, path, args, kwargs = field.deconstruct() - self.assertEqual(name, None) + self.assertIsNone(name) field.set_attributes_from_name("author") name, path, args, kwargs = field.deconstruct() self.assertEqual(name, "author") |
