  
          test_gmbh.point_of_contact = test_gmbh.ceo
          test_gmbh.save()
          test_gmbh.name = F("ceo__last_name")
          self.assertRaises(FieldError, test_gmbh.save)
  
      def test_object_update_unsaved_objects(self):
          # F expressions cannot be used to update attributes on objects which do
          # not yet exist in the database
          test_gmbh = Company.objects.get(name="Test GmbH")
 
</s> remove         self.assertRaises(ValueError, test)
 </s> add         with self.assertRaises(ValueError):
            test() </s> remove         self.assertRaises(AssertionError, method,
                          another_value='another thing')
 </s> add         with self.assertRaises(AssertionError):
            method(another_value='another thing') </s> remove         self.assertRaises(ValueError, qs.aggregate, Union('name'))
 </s> add         with self.assertRaises(ValueError):
            qs.aggregate(Union('name')) </s> remove         self.assertRaises(AttributeError, lambda: CommonInfo.objects.all())
 </s> add         with self.assertRaises(AttributeError):
            CommonInfo.objects.all() </s> remove         self.assertRaises(FieldError, Restaurant.objects.filter, supplier__name="foo")
 </s> add         with self.assertRaises(FieldError):
            Restaurant.objects.filter(supplier__name="foo")
        with self.assertRaises(FieldError):
            test_gmbh.save()
  
          test_gmbh.point_of_contact = test_gmbh.ceo
          test_gmbh.save()
          test_gmbh.name = F("ceo__last_name")
        with self.assertRaises(FieldError):
            test_gmbh.save()
  
      def test_object_update_unsaved_objects(self):
          # F expressions cannot be used to update attributes on objects which do
          # not yet exist in the database
          test_gmbh = Company.objects.get(name="Test GmbH")
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/expressions/tests.py