          self.assertRaises(ValidationError, form.fields['full_name'].clean, 'not int nor mail')
  
          try:
              form.fields['full_name'].clean('not int nor mail')
          except ValidationError as e:
              self.assertEqual(2, len(e.messages))
  
          self.assertFalse(form.is_valid())
          self.assertEqual(form.errors['string'], ["Letters only."])
          self.assertEqual(form.errors['string'], ["Letters only."])
 
</s> remove         self.assertRaises(ValidationError, form.fields['full_name'].clean, 'not int nor mail')

        try:
 </s> add         with self.assertRaises(ValidationError) as e: </s> remove         self.assertRaises(
            Book.DoesNotExist,
            Book.objects.using('other').get,
            title="Pro Django"
        )
 </s> add         with self.assertRaises(Book.DoesNotExist):
            Book.objects.using('other').get(title="Pro Django") </s> remove             self.assertRaises(ValueError, self.client.get, '/bad_view/')
 </s> add             with self.assertRaises(ValueError):
                self.client.get('/bad_view/') </s> remove         self.assertRaises(ValidationError, f.clean, "a", None)
 </s> add         with self.assertRaises(ValidationError):
            f.clean("a", None) </s> remove         self.assertRaises(
            Book.DoesNotExist,
            Book.objects.using('other').get,
            title="Pro Django"
        )
 </s> add         with self.assertRaises(Book.DoesNotExist):
            Book.objects.using('other').get(title="Pro Django")
        self.assertEqual(2, len(e.exception.messages))
          self.assertRaises(ValidationError, form.fields['full_name'].clean, 'not int nor mail')
  
          try:
              form.fields['full_name'].clean('not int nor mail')
        self.assertEqual(2, len(e.exception.messages))
        self.assertEqual(2, len(e.exception.messages))
  
          self.assertFalse(form.is_valid())
          self.assertEqual(form.errors['string'], ["Letters only."])
          self.assertEqual(form.errors['string'], ["Letters only."])
keep keep keep keep replace replace keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/forms_tests/tests/test_validators.py