          a1 = Account.objects.create(num=1)
          a2 = Account.objects.create(num=2)
          e1.accounts.set([a1, a2])
  
          with self.assertRaises(ValueError):
              e1.save(update_fields=['accounts'])
  
      def test_update_fields_inheritance(self):
          profile_boss = Profile.objects.create(name='Boss', salary=3000)
          profile_receptionist = Profile.objects.create(name='Receptionist', salary=1000)
 
</s> remove         with self.assertRaises(FieldError):
 </s> add         msg = (
            "Cannot resolve keyword 'tags' into field. Choices are: "
            "active_translation, active_translation_q, articletranslation, "
            "id, idea_things, newsarticle, pub_date, tag"
        )
        with self.assertRaisesMessage(FieldError, msg): </s> remove         with self.assertRaises(ValueError):
 </s> add         msg = 'F(ceo)": "Company.point_of_contact" must be a "Employee" instance.'
        with self.assertRaisesMessage(ValueError, msg): </s> remove         with self.assertRaises(ValueError):
 </s> add         msg = 'backend does not support timezone-aware datetimes when USE_TZ is False.'
        with self.assertRaisesMessage(ValueError, msg): </s> remove         with self.assertRaises(ValueError):
 </s> add         with self.assertRaisesMessage(ValueError, self.msg % 'first_name'): </s> remove         with self.assertRaises(ValueError):
 </s> add         # "name" is treated as an iterable so the output is something like
        # "n, a, m, e" but the order isn't deterministic.
        with self.assertRaisesMessage(ValueError, self.msg % ''):
        with self.assertRaisesMessage(ValueError, self.msg % 'accounts'):
          a1 = Account.objects.create(num=1)
          a2 = Account.objects.create(num=2)
          e1.accounts.set([a1, a2])
  
        with self.assertRaisesMessage(ValueError, self.msg % 'accounts'):
              e1.save(update_fields=['accounts'])
  
      def test_update_fields_inheritance(self):
          profile_boss = Profile.objects.create(name='Boss', salary=3000)
          profile_receptionist = Profile.objects.create(name='Receptionist', salary=1000)
keep keep keep keep replace keep keep keep keep keep
 Used assertRaisesMessage() to test Django's error messages. 
tests/update_only_fields/tests.py