          with 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)
 
</s> remove         with self.assertRaises(ImproperlyConfigured):
 </s> add         msg = (
            'BookArchive is missing a QuerySet. Define BookArchive.model, '
            'BookArchive.queryset, or override BookArchive.get_queryset().'
        )
        with self.assertRaisesMessage(ImproperlyConfigured, msg): </s> remove         with self.assertRaises(ImproperlyConfigured):
 </s> add         msg = (
            'No URL to redirect to.  Either provide a url or define a '
            'get_absolute_url method on the Model.'
        )
        with self.assertRaisesMessage(ImproperlyConfigured, msg): </s> remove         with self.assertRaises(FieldError):
 </s> add         msg = (
            "Cannot resolve keyword 'firstname' into field. Choices are: "
            "Author_ID, article, first_name, last_name, primary_set"
        )
        with self.assertRaisesMessage(FieldError, msg): </s> remove         with self.assertRaises(ImproperlyConfigured):
 </s> add         msg = "'apps.apps.BadConfig' must supply a name attribute."
        with self.assertRaisesMessage(ImproperlyConfigured, msg): </s> remove         with self.assertRaises(ImproperlyConfigured):
 </s> add         msg = "'apps.apps.NotAConfig' isn't a subclass of AppConfig."
        with self.assertRaisesMessage(ImproperlyConfigured, msg):
        msg = (
            'AuthorDetail is missing a QuerySet. Define AuthorDetail.model, '
            'AuthorDetail.queryset, or override AuthorDetail.get_queryset().'
        )
        with self.assertRaisesMessage(ImproperlyConfigured, msg):
          with self.assertRaises(AttributeError):
              self.client.get('/detail/author/invalid/url/')
  
      def test_invalid_queryset(self):
        msg = (
            'AuthorDetail is missing a QuerySet. Define AuthorDetail.model, '
            'AuthorDetail.queryset, or override AuthorDetail.get_queryset().'
        )
        with self.assertRaisesMessage(ImproperlyConfigured, msg):
              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)
keep keep keep keep replace keep keep keep keep keep
 Used assertRaisesMessage() to test Django's error messages. 
tests/generic_views/test_detail.py