          # constraints are also enforced for proxy models. Refs #17519
          a2 = models.Article(headline='This is another test', reporter=self.r,
                              pub_date=datetime.datetime(2012, 8, 3),
                              reporter_proxy_id=30)
          self.assertRaises(IntegrityError, a2.save)
  
      def test_integrity_checks_on_update(self):
          """
          Try to update a model instance introducing a FK constraint violation.
          If it fails it should fail with IntegrityError.
 
</s> remove         self.assertRaises(IntegrityError, a2.save)
 </s> add         with self.assertRaises(IntegrityError):
            a2.save() </s> remove         self.assertRaises(ValueError, Author.objects.annotate, friends=Count('friends'))
 </s> add         with self.assertRaises(ValueError):
            Author.objects.annotate(friends=Count('friends')) </s> remove         self.assertRaises(ValueError, str, qs.query)
 </s> add         with self.assertRaises(ValueError):
            str(qs.query) </s> remove         self.assertRaises(exception, force_text, MyString())
 </s> add         with self.assertRaises(exception):
            force_text(MyString()) </s> remove         self.assertRaises(IntegrityError, a.protect.delete)
 </s> add         with self.assertRaises(IntegrityError):
            a.protect.delete()
        with self.assertRaises(IntegrityError):
            a2.save()
          # constraints are also enforced for proxy models. Refs #17519
          a2 = models.Article(headline='This is another test', reporter=self.r,
                              pub_date=datetime.datetime(2012, 8, 3),
                              reporter_proxy_id=30)
        with self.assertRaises(IntegrityError):
            a2.save()
  
      def test_integrity_checks_on_update(self):
          """
          Try to update a model instance introducing a FK constraint violation.
          If it fails it should fail with IntegrityError.
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/backends/tests.py