  
          # Trying to update should still fail, even with manual primary keys, if
          # the data isn't in the database already.
          obj = WithCustomPK(name=1, value=1)
          with self.assertRaises(DatabaseError):
              with transaction.atomic():
                  obj.save(force_update=True)
  
  
  class InheritanceTests(TestCase):
 
</s> remove         with self.assertRaises(ValueError):
 </s> add         msg = 'Cannot force an update in save() with no primary key.'
        with self.assertRaisesMessage(ValueError, msg): </s> remove                 with self.assertRaises(AttributeError):
 </s> add                 msg = "%r object has no attribute 'optout_public_method'" % manager.__class__.__name__
                with self.assertRaisesMessage(AttributeError, 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(ValueError):
 </s> add         msg = 'Cannot force both insert and updating in model saving.'
        with self.assertRaisesMessage(ValueError, msg): </s> remove             with self.assertRaises(transaction.TransactionManagementError):
 </s> add             msg = 'on_commit() cannot be used in manual transaction management'
            with self.assertRaisesMessage(transaction.TransactionManagementError, msg):
        msg = 'Forced update did not affect any rows.'
        with self.assertRaisesMessage(DatabaseError, msg):
  
          # Trying to update should still fail, even with manual primary keys, if
          # the data isn't in the database already.
          obj = WithCustomPK(name=1, value=1)
        msg = 'Forced update did not affect any rows.'
        with self.assertRaisesMessage(DatabaseError, msg):
              with transaction.atomic():
                  obj.save(force_update=True)
  
  
  class InheritanceTests(TestCase):
keep keep keep keep replace keep keep keep keep keep
 Used assertRaisesMessage() to test Django's error messages. 
tests/force_insert_update/tests.py