          with self.assertRaises(AssertionError):
              with self.assertTemplateUsed(template_name=''):
                  pass
  
          with self.assertRaises(AssertionError):
              with self.assertTemplateUsed('template_used/base.html'):
                  render_to_string('template_used/alternative.html')
  
      def test_assert_used_on_http_response(self):
          response = HttpResponse()
 
</s> remove         with self.assertRaises(AssertionError):
 </s> add         with self.assertRaisesMessage(AssertionError, msg): </s> remove         with self.assertRaises(AssertionError):
 </s> add         with self.assertRaisesMessage(AssertionError, msg): </s> remove         with self.assertRaises(TypeError):
 </s> add         msg = 'response and/or template_name argument must be provided'
        with self.assertRaisesMessage(TypeError, msg): </s> remove         with self.assertRaises(AssertionError):
 </s> add         msg = 'No templates used to render the response'
        with self.assertRaisesMessage(AssertionError, msg): </s> remove         with self.assertRaises(AssertionError):
 </s> add         msg = (
            "earliest() and latest() require either a field_name parameter or "
            "'get_latest_by' in the model"
        )
        with self.assertRaisesMessage(AssertionError, msg):
        msg = (
            'template_used/base.html was not rendered. Following '
            'templates were rendered: template_used/alternative.html'
        )
        with self.assertRaisesMessage(AssertionError, msg):
          with self.assertRaises(AssertionError):
              with self.assertTemplateUsed(template_name=''):
                  pass
  
        msg = (
            'template_used/base.html was not rendered. Following '
            'templates were rendered: template_used/alternative.html'
        )
        with self.assertRaisesMessage(AssertionError, msg):
              with self.assertTemplateUsed('template_used/base.html'):
                  render_to_string('template_used/alternative.html')
  
      def test_assert_used_on_http_response(self):
          response = HttpResponse()
keep keep keep keep replace keep keep keep keep keep
 Used assertRaisesMessage() to test Django's error messages. 
tests/test_utils/tests.py