diff options
Diffstat (limited to 'tests/model_fields')
| -rw-r--r-- | tests/model_fields/tests.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py index 3d791980ba..23e90cccb8 100644 --- a/tests/model_fields/tests.py +++ b/tests/model_fields/tests.py @@ -98,8 +98,13 @@ class BasicFieldTests(test.TestCase): self.assertTrue(instance.id) # Set field to object on saved instance instance.size = instance + msg = ( + "Tried to update field model_fields.FloatModel.size with a model " + "instance, <FloatModel: FloatModel object>. Use a value " + "compatible with FloatField." + ) with transaction.atomic(): - with self.assertRaises(TypeError): + with self.assertRaisesMessage(TypeError, msg): instance.save() # Try setting field to object on retrieved object obj = FloatModel.objects.get(pk=instance.id) |
