From 2572c07cc64177e985b453d0f0b819e85fe080cc Mon Sep 17 00:00:00 2001 From: Loic Bistuer Date: Sun, 6 Jul 2014 13:57:23 +0700 Subject: Fixed #22906 -- Added a more helpful repr to migrations' ModelState. Thanks Collin Anderson for the report and original patch. --- tests/migrations/test_state.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') 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), "") + + project_state = ProjectState() + project_state.add_model_state(state) + with self.assertRaisesMessage(InvalidBasesError, "Cannot resolve bases for []"): + project_state.render() -- cgit v1.3