summaryrefslogtreecommitdiff
path: root/tests/model_fields
diff options
context:
space:
mode:
authorMorgan Aubert <morgan.aubert@savoirfairelinux.com>2016-12-14 11:48:57 -0500
committerTim Graham <timograham@gmail.com>2016-12-14 13:35:13 -0500
commitadb791fdcbdbd6d1b5c258d114b88953d2248c13 (patch)
treeb090c6eb3f1b0f15cd29612713f9d1cd4066d345 /tests/model_fields
parent92c5eeac3358e8243e29604d51b724f46fd5305f (diff)
Moved test_field_ordering to the model_fields package.
Diffstat (limited to 'tests/model_fields')
-rw-r--r--tests/model_fields/tests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py
index 85e2825165..f7faf399c7 100644
--- a/tests/model_fields/tests.py
+++ b/tests/model_fields/tests.py
@@ -59,6 +59,16 @@ class BasicFieldTests(TestCase):
f = Foo._meta.get_field('a')
self.assertEqual(force_str(f), 'model_fields.Foo.a')
+ def test_field_ordering(self):
+ """Fields are ordered based on their creation."""
+ f1 = models.Field()
+ f2 = models.Field(auto_created=True)
+ f3 = models.Field()
+ self.assertLess(f2, f1)
+ self.assertGreater(f3, f1)
+ self.assertIsNotNone(f1)
+ self.assertNotIn(f2, (None, 1, ''))
+
class ChoicesTests(SimpleTestCase):