              str
          )
  
      def test_field_error(self):
          with self.assertRaises(FieldError):
              Author.objects.filter(firstname__exact="John")
  
      def test_attribute_error(self):
          with self.assertRaises(AttributeError):
              self.a1.firstname
 
</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, pages, price, "
            "pubdate, publisher, publisher_id, rating, store, tags"
        )
        with self.assertRaisesMessage(FieldError, msg): </s> remove         with self.assertRaises(AttributeError):
 </s> add         with self.assertRaisesMessage(AttributeError, "Unable to lookup 'unknown' on Article"): </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 = "Joined field references are not permitted in this query"
            with self.assertRaisesMessage(FieldError, msg): </s> remove         with self.assertRaises(FieldError):
 </s> add         msg = "Unsupported lookup 'blahblah' for CharField or join on the field not permitted."
        with self.assertRaisesMessage(FieldError, msg):
        msg = (
            "Cannot resolve keyword 'firstname' into field. Choices are: "
            "Author_ID, article, first_name, last_name, primary_set"
        )
        with self.assertRaisesMessage(FieldError, msg):
              str
          )
  
      def test_field_error(self):
        msg = (
            "Cannot resolve keyword 'firstname' into field. Choices are: "
            "Author_ID, article, first_name, last_name, primary_set"
        )
        with self.assertRaisesMessage(FieldError, msg):
              Author.objects.filter(firstname__exact="John")
  
      def test_attribute_error(self):
          with self.assertRaises(AttributeError):
              self.a1.firstname
keep keep keep keep replace keep keep keep keep keep
 Used assertRaisesMessage() to test Django's error messages. 
tests/custom_columns/tests.py