summaryrefslogtreecommitdiff
path: root/tests/forms_tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/forms_tests')
-rw-r--r--tests/forms_tests/field_tests/test_uuidfield.py3
-rw-r--r--tests/forms_tests/tests/test_formsets.py3
-rw-r--r--tests/forms_tests/tests/tests.py6
3 files changed, 8 insertions, 4 deletions
diff --git a/tests/forms_tests/field_tests/test_uuidfield.py b/tests/forms_tests/field_tests/test_uuidfield.py
index 08498ab9c9..ed08efd659 100644
--- a/tests/forms_tests/field_tests/test_uuidfield.py
+++ b/tests/forms_tests/field_tests/test_uuidfield.py
@@ -18,9 +18,8 @@ class UUIDFieldTest(SimpleTestCase):
def test_uuidfield_3(self):
field = UUIDField()
- with self.assertRaises(ValidationError) as cm:
+ with self.assertRaisesMessage(ValidationError, 'Enter a valid UUID.'):
field.clean('550e8400')
- self.assertEqual(cm.exception.messages[0], 'Enter a valid UUID.')
def test_uuidfield_4(self):
field = UUIDField()
diff --git a/tests/forms_tests/tests/test_formsets.py b/tests/forms_tests/tests/test_formsets.py
index 29f138b2d1..defa46b730 100644
--- a/tests/forms_tests/tests/test_formsets.py
+++ b/tests/forms_tests/tests/test_formsets.py
@@ -1338,7 +1338,8 @@ ArticleFormSet = formset_factory(ArticleForm)
class TestIsBoundBehavior(SimpleTestCase):
def test_no_data_raises_validation_error(self):
- with self.assertRaises(ValidationError):
+ msg = 'ManagementForm data is missing or has been tampered with'
+ with self.assertRaisesMessage(ValidationError, msg):
ArticleFormSet({}).is_valid()
def test_with_management_data_attrs_work_fine(self):
diff --git a/tests/forms_tests/tests/tests.py b/tests/forms_tests/tests/tests.py
index 043b8e0edc..a54ad09c26 100644
--- a/tests/forms_tests/tests/tests.py
+++ b/tests/forms_tests/tests/tests.py
@@ -247,7 +247,11 @@ class RelatedModelFormTests(SimpleTestCase):
model = A
fields = '__all__'
- with self.assertRaises(ValueError):
+ msg = (
+ "Cannot create form field for 'ref' yet, because "
+ "its related model 'B' has not been loaded yet"
+ )
+ with self.assertRaisesMessage(ValueError, msg):
ModelFormMetaclass('Form', (ModelForm,), {'Meta': Meta})
class B(models.Model):