          res = self.client.get('/detail/author/500/')
          self.assertEqual(res.status_code, 404)
  
      def test_detail_object_does_not_exist(self):
          self.assertRaises(ObjectDoesNotExist, self.client.get, '/detail/doesnotexist/1/')
  
      def test_detail_by_custom_pk(self):
          res = self.client.get('/detail/author/bycustompk/%s/' % self.author1.pk)
          self.assertEqual(res.status_code, 200)
          self.assertEqual(res.context['object'], self.author1)
 
</s> remove         self.assertRaises(ImproperlyConfigured, self.client.get, '/detail/author/invalid/qs/')
 </s> add         with self.assertRaises(ImproperlyConfigured):
            self.client.get('/detail/author/invalid/qs/') </s> remove         self.assertRaises(ImproperlyConfigured, self.client.get, '/dates/books/invalid/')
 </s> add         with self.assertRaises(ImproperlyConfigured):
            self.client.get('/dates/books/invalid/') </s> remove         self.assertRaises(NoReverseMatch, redirect, 'not-a-view')
 </s> add         with self.assertRaises(NoReverseMatch):
            redirect('not-a-view') </s> remove         self.assertRaises(AttributeError, self.client.get, '/detail/author/invalid/url/')
 </s> add         with self.assertRaises(AttributeError):
            self.client.get('/detail/author/invalid/url/') </s> remove         self.assertRaises(NoReverseMatch, redirect, absolute_kwargs_view, wrong_argument=None)
 </s> add         with self.assertRaises(NoReverseMatch):
            redirect(absolute_kwargs_view, wrong_argument=None)
        with self.assertRaises(ObjectDoesNotExist):
            self.client.get('/detail/doesnotexist/1/')
          res = self.client.get('/detail/author/500/')
          self.assertEqual(res.status_code, 404)
  
      def test_detail_object_does_not_exist(self):
        with self.assertRaises(ObjectDoesNotExist):
            self.client.get('/detail/doesnotexist/1/')
  
      def test_detail_by_custom_pk(self):
          res = self.client.get('/detail/author/bycustompk/%s/' % self.author1.pk)
          self.assertEqual(res.status_code, 200)
          self.assertEqual(res.context['object'], self.author1)
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/generic_views/test_detail.py