          self.assertEqual(list(res.context['latest']), list(Book.objects.all()))
          self.assertTemplateUsed(res, 'generic_views/book_detail.html')
  
      def test_archive_view_invalid(self):
          with self.assertRaises(ImproperlyConfigured):
              self.client.get('/dates/books/invalid/')
  
      def test_archive_view_by_month(self):
          res = self.client.get('/dates/books/by_month/')
          self.assertEqual(res.status_code, 200)
 
</s> remove         with self.assertRaises(ImproperlyConfigured):
 </s> add         msg = (
            'AuthorDetail is missing a QuerySet. Define AuthorDetail.model, '
            'AuthorDetail.queryset, or override AuthorDetail.get_queryset().'
        )
        with self.assertRaisesMessage(ImproperlyConfigured, msg): </s> remove         with self.assertRaises(ImproperlyConfigured):
 </s> add         msg = (
            'AuthorList is missing a QuerySet. Define AuthorList.model, '
            'AuthorList.queryset, or override AuthorList.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(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 = (
            'No authentication backends have been defined. '
            'Does AUTHENTICATION_BACKENDS contain anything?'
        )
        with self.assertRaisesMessage(ImproperlyConfigured, msg):
        msg = (
            'BookArchive is missing a QuerySet. Define BookArchive.model, '
            'BookArchive.queryset, or override BookArchive.get_queryset().'
        )
        with self.assertRaisesMessage(ImproperlyConfigured, msg):
          self.assertEqual(list(res.context['latest']), list(Book.objects.all()))
          self.assertTemplateUsed(res, 'generic_views/book_detail.html')
  
      def test_archive_view_invalid(self):
        msg = (
            'BookArchive is missing a QuerySet. Define BookArchive.model, '
            'BookArchive.queryset, or override BookArchive.get_queryset().'
        )
        with self.assertRaisesMessage(ImproperlyConfigured, msg):
              self.client.get('/dates/books/invalid/')
  
      def test_archive_view_by_month(self):
          res = self.client.get('/dates/books/by_month/')
          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_dates.py