      def test_invalid_url(self):
          self.assertRaises(AttributeError, self.client.get, '/detail/author/invalid/url/')
  
      def test_invalid_queryset(self):
          self.assertRaises(ImproperlyConfigured, self.client.get, '/detail/author/invalid/qs/')
  
      def test_non_model_object_with_meta(self):
          res = self.client.get('/detail/nonmodel/1/')
          self.assertEqual(res.status_code, 200)
          self.assertEqual(res.context['object'].id, "non_model_1")
 
</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(ObjectDoesNotExist, self.client.get, '/detail/doesnotexist/1/')
 </s> add         with self.assertRaises(ObjectDoesNotExist):
            self.client.get('/detail/doesnotexist/1/') </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(AttributeError, self.client.get, "/dates/books/2008/oct/01/nopk/")
 </s> add         with self.assertRaises(AttributeError):
            self.client.get("/dates/books/2008/oct/01/nopk/") </s> remove         self.assertRaises(ImproperlyConfigured, self.client.get, '/list/authors/invalid/')
 </s> add         with self.assertRaises(ImproperlyConfigured):
            self.client.get('/list/authors/invalid/')
        with self.assertRaises(ImproperlyConfigured):
            self.client.get('/detail/author/invalid/qs/')
      def test_invalid_url(self):
          self.assertRaises(AttributeError, self.client.get, '/detail/author/invalid/url/')
  
      def test_invalid_queryset(self):
        with self.assertRaises(ImproperlyConfigured):
            self.client.get('/detail/author/invalid/qs/')
  
      def test_non_model_object_with_meta(self):
          res = self.client.get('/detail/nonmodel/1/')
          self.assertEqual(res.status_code, 200)
          self.assertEqual(res.context['object'].id, "non_model_1")
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