          a1 = Author.objects.create(name="Brave Sir Robin")
          a2 = Author.objects.create(name="Patsy")
  
          # No Articles yet, so we should get a Http404 error.
          self.assertRaises(Http404, get_object_or_404, Article, title="Foo")
  
          article = Article.objects.create(title="Run away!")
          article.authors.set([a1, a2])
          # get_object_or_404 can be passed a Model to query.
          self.assertEqual(
 
</s> remove         self.assertRaises(Article.DoesNotExist, Article.objects.earliest)
 </s> add         with self.assertRaises(Article.DoesNotExist):
            Article.objects.earliest() </s> remove         self.assertRaises(IntegrityError, a2.save)
 </s> add         with self.assertRaises(IntegrityError):
            a2.save() </s> remove         self.assertRaises(Article.DoesNotExist, Article.objects.latest)
 </s> add         with self.assertRaises(Article.DoesNotExist):
            Article.objects.latest() </s> remove         self.assertRaises(IntegrityError, a.protect.delete)
 </s> add         with self.assertRaises(IntegrityError):
            a.protect.delete() </s> remove             self.assertRaises(TypeError, lm.save, fid_range=bad)
 </s> add             with self.assertRaises(TypeError):
                lm.save(fid_range=bad)
        with self.assertRaises(Http404):
            get_object_or_404(Article, title="Foo")
          a1 = Author.objects.create(name="Brave Sir Robin")
          a2 = Author.objects.create(name="Patsy")
  
          # No Articles yet, so we should get a Http404 error.
        with self.assertRaises(Http404):
            get_object_or_404(Article, title="Foo")
  
          article = Article.objects.create(title="Run away!")
          article.authors.set([a1, a2])
          # get_object_or_404 can be passed a Model to query.
          self.assertEqual(
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/get_object_or_404/tests.py