summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLoic Bistuer <loic.bistuer@gmail.com>2014-07-06 13:57:23 +0700
committerLoic Bistuer <loic.bistuer@gmail.com>2014-07-06 14:56:18 +0700
commit2572c07cc64177e985b453d0f0b819e85fe080cc (patch)
tree4686f77800ab25134097e0c3ad879ed3fa69c4e2 /tests
parent32fefc6f70c529ee5f13b2d82a26333fb7a4ed14 (diff)
Fixed #22906 -- Added a more helpful repr to migrations' ModelState.
Thanks Collin Anderson for the report and original patch.
Diffstat (limited to 'tests')
-rw-r--r--tests/migrations/test_state.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/migrations/test_state.py b/tests/migrations/test_state.py
index 45b3d363de..ebeaffb787 100644
--- a/tests/migrations/test_state.py
+++ b/tests/migrations/test_state.py
@@ -420,3 +420,13 @@ class ModelStateTests(TestCase):
state = ModelState('app', 'Model', [('name', field)])
Model = state.render(apps)
self.assertNotEqual(Model._meta.get_field('name'), field)
+
+ def test_repr(self):
+ field = models.CharField(max_length=1)
+ state = ModelState('app', 'Model', [('name', field)], bases=['app.A', 'app.B', 'app.C'])
+ self.assertEqual(repr(state), "<ModelState: 'app.Model'>")
+
+ project_state = ProjectState()
+ project_state.add_model_state(state)
+ with self.assertRaisesMessage(InvalidBasesError, "Cannot resolve bases for [<ModelState: 'app.Model'>]"):
+ project_state.render()