              'full_name': 'not int nor mail',
              'string': '2 is not correct',
              'ignore_case_string': "IgnORE Case strIng",
          })
          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())
 
</s> remove         except ValidationError as e:
            self.assertEqual(2, len(e.messages))
 </s> add         self.assertEqual(2, len(e.exception.messages)) </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(
            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)
        with self.assertRaises(ValidationError) as e:
              'full_name': 'not int nor mail',
              'string': '2 is not correct',
              'ignore_case_string': "IgnORE Case strIng",
          })
        with self.assertRaises(ValidationError) as e:
        with self.assertRaises(ValidationError) as e:
        with self.assertRaises(ValidationError) as e:
              form.fields['full_name'].clean('not int nor mail')
          except ValidationError as e:
              self.assertEqual(2, len(e.messages))
  
          self.assertFalse(form.is_valid())
keep keep keep keep replace replace replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/forms_tests/tests/test_validators.py