'FieldError is raised if a relation field that is not followed in the
query is specified in of=(...).'

@skipUnlessDBFeature('has_select_for_update', 'has_select_for_update_of')
def test_related_but_unselected_of_argument_raises_error(self):

    msg = 'Invalid    field    name(s)    given    in    select_for_update(of=(...)):    %s.    Only    relational    fields    followed    in    the    query    are    allowed.    Choices    are:    self,    born.'
    for name in ['born__country', 'died', 'died__country']:
        with self.subTest(name=name):
            with self.assertRaisesMessage(FieldError, (msg % name)):
                with transaction.atomic():
                    Person.objects.select_related('born').select_for_update(of=(name,)).get()
