              "foo",
          )
  
          with transaction.atomic():
              with self.assertRaises(FieldError):
                  Company.objects.exclude(
                      ceo__firstname=F('point_of_contact__firstname')
                  ).update(name=F('point_of_contact__lastname'))
  
      def test_object_update(self):
 
</s> remove             with self.assertRaises(transaction.TransactionManagementError):
 </s> add             with self.assertRaisesMessage(transaction.TransactionManagementError, self.forbidden_atomic_msg): </s> remove             with self.assertRaises(transaction.TransactionManagementError):
 </s> add             with self.assertRaisesMessage(transaction.TransactionManagementError, self.forbidden_atomic_msg): </s> remove             with self.assertRaises(transaction.TransactionManagementError):
 </s> add             with self.assertRaisesMessage(transaction.TransactionManagementError, self.forbidden_atomic_msg): </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(FieldError):
 </s> add         msg = "Unsupported lookup 'blahblah' for CharField or join on the field not permitted."
        with self.assertRaisesMessage(FieldError, msg):
            msg = "Joined field references are not permitted in this query"
            with self.assertRaisesMessage(FieldError, msg):
              "foo",
          )
  
          with transaction.atomic():
            msg = "Joined field references are not permitted in this query"
            with self.assertRaisesMessage(FieldError, msg):
                  Company.objects.exclude(
                      ceo__firstname=F('point_of_contact__firstname')
                  ).update(name=F('point_of_contact__lastname'))
  
      def test_object_update(self):
keep keep keep keep replace keep keep keep keep keep
 Used assertRaisesMessage() to test Django's error messages. 
tests/expressions/tests.py