                                        reporter=self.r, reporter_proxy=r_proxy)
          # Retrieve the second article from the DB
          a2 = models.Article.objects.get(headline='Another article')
          a2.reporter_proxy_id = 30
          self.assertRaises(IntegrityError, a2.save)
  
      def test_disable_constraint_checks_manually(self):
          """
          When constraint checks are disabled, should be able to write bad data
          without IntegrityErrors.
 
</s> remove         self.assertRaises(IntegrityError, a2.save)
 </s> add         with self.assertRaises(IntegrityError):
            a2.save() </s> remove         self.assertRaises(Http404, get_object_or_404, Article, title="Foo")
 </s> add         with self.assertRaises(Http404):
            get_object_or_404(Article, title="Foo") </s> remove         self.assertRaises(Site.DoesNotExist, Site.objects.get_current)
 </s> add         with self.assertRaises(Site.DoesNotExist):
            Site.objects.get_current() </s> remove         self.assertRaises(LayerMapError, LayerMapping,
                          Point3D, city_file, point_mapping, transform=False)
 </s> add         with self.assertRaises(LayerMapError):
            LayerMapping(Point3D, city_file, point_mapping, transform=False) </s> remove             self.assertRaises(ValueError, wkb_w._set_outdim, bad_outdim)
 </s> add             with self.assertRaises(ValueError):
                wkb_w._set_outdim(bad_outdim)
        with self.assertRaises(IntegrityError):
            a2.save()
                                        reporter=self.r, reporter_proxy=r_proxy)
          # Retrieve the second article from the DB
          a2 = models.Article.objects.get(headline='Another article')
          a2.reporter_proxy_id = 30
        with self.assertRaises(IntegrityError):
            a2.save()
  
      def test_disable_constraint_checks_manually(self):
          """
          When constraint checks are disabled, should be able to write bad data
          without IntegrityErrors.
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/backends/tests.py