          """
          Exception is raised when trying to register an abstract model.
          Refs #12004.
          """
          with self.assertRaises(ImproperlyConfigured):
              self.site.register(Location)
  
      def test_is_registered_model(self):
          "Checks for registered models should return true."
          self.site.register(Person)
 
</s> remove         with self.assertRaises(TemplateSyntaxError):
 </s> add         with self.assertRaisesMessage(TemplateSyntaxError, "Invalid filter: 'fil'"): </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): </s> remove         with self.assertRaises(TemplateSyntaxError):
 </s> add         msg = (
            "Invalid block tag on line 1: 'nothing_to_see_here'. Did you "
            "forget to register or load this tag?"
        )
        with self.assertRaisesMessage(TemplateSyntaxError, msg): </s> remove         with self.assertRaises(ImproperlyConfigured):
 </s> add         msg = (
            "TemplateResponseMixin requires either a definition of "
            "'template_name' or an implementation of 'get_template_names()'"
        )
        with self.assertRaisesMessage(ImproperlyConfigured, msg):
        msg = 'The model Location is abstract, so it cannot be registered with admin.'
        with self.assertRaisesMessage(ImproperlyConfigured, msg):
          """
          Exception is raised when trying to register an abstract model.
          Refs #12004.
          """
        msg = 'The model Location is abstract, so it cannot be registered with admin.'
        with self.assertRaisesMessage(ImproperlyConfigured, msg):
              self.site.register(Location)
  
      def test_is_registered_model(self):
          "Checks for registered models should return true."
          self.site.register(Person)
keep keep keep keep replace keep keep keep keep keep
 Used assertRaisesMessage() to test Django's error messages. 
tests/admin_registration/tests.py