              label_for_field("__str__", Article),
              "article"
          )
  
          with self.assertRaises(AttributeError):
              label_for_field("unknown", Article)
  
          def test_callable(obj):
              return "nothing"
          self.assertEqual(
 
</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 = (
            '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(FieldError):
 </s> add         msg = "Cannot compute Avg('mean_age'): 'mean_age' is an aggregate"
        with self.assertRaisesMessage(FieldError, msg): </s> remove         with self.assertRaises(FieldError):
 </s> add         msg = (
            "Cannot resolve keyword 'foo' into field. Choices are: authors, "
            "contact, contact_id, hardbackbook, id, isbn, name, num_authors, "
            "pages, price, pubdate, publisher, publisher_id, rating, store, tags"
        )
        with self.assertRaisesMessage(FieldError, msg): </s> remove         with self.assertRaises(TemplateSyntaxError):
 </s> add         msg = (
            "get_flatpages expects a syntax of get_flatpages "
            "['url_starts_with'] [for user] as context_name"
        )
        with self.assertRaisesMessage(TemplateSyntaxError, msg):
        with self.assertRaisesMessage(AttributeError, "Unable to lookup 'unknown' on Article"):
              label_for_field("__str__", Article),
              "article"
          )
  
        with self.assertRaisesMessage(AttributeError, "Unable to lookup 'unknown' on Article"):
              label_for_field("unknown", Article)
  
          def test_callable(obj):
              return "nothing"
          self.assertEqual(
keep keep keep keep replace keep keep keep keep keep
 Used assertRaisesMessage() to test Django's error messages. 
tests/admin_utils/tests.py