  
          with self.assertRaisesMessage(FieldDoesNotExist, 'invalid_field'):
              Event().invitees.all()
  
      def test_invalid_m2m_reverse_field(self):
          """
          Tests that providing invalid reverse field name to ManyToManyField.through_fields
          raises FieldDoesNotExist.
          """
          class Fan(models.Model):
 
</s> remove         Tests that providing invalid reverse field name to ManyToManyField.through_fields
        raises FieldDoesNotExist.
 </s> add         Tests that providing invalid field names to ManyToManyField.through_fields
        triggers validation errors. </s> remove         with self.assertRaisesMessage(FieldDoesNotExist, 'invalid_field'):
            Event().invitees.all()
 </s> add         field = Event._meta.get_field('invitees')
        errors = field.check(from_model=Event)
        expected = [
            Error(
                ("'Invitation.invitee' is not a foreign key to 'Event'."),
                hint="Did you mean one of the following foreign keys to 'Event': event?",
                obj=field,
                id='fields.E339'),
            Error(
                ("'Invitation.event' is not a foreign key to 'Fan'."),
                hint="Did you mean one of the following foreign keys to 'Fan': invitee, inviter?",
                obj=field,
                id='fields.E339'),
        ]
        self.assertEqual(expected, errors) </s> remove         Tests that providing invalid source field name to ManyToManyField.through_fields
        raises FieldDoesNotExist.
 </s> add         Tests that mixing up the order of link fields to ManyToManyField.through_fields
        triggers validation errors. </s> remove     def test_invalid_m2m_field(self):
 </s> add     def test_invalid_order(self): </s> remove         with self.assertRaisesMessage(FieldDoesNotExist, 'invalid_field'):
            Event().invitees.all()
 </s> add         field = Event._meta.get_field('invitees')
        errors = field.check(from_model=Event)
        expected = [
            Error(
                ("The intermediary model 'invalid_models_tests.Invitation' has no field 'invalid_field_1'."),
                hint="Did you mean one of the following foreign keys to 'Event': event?",
                obj=field,
                id='fields.E338'),
            Error(
                ("The intermediary model 'invalid_models_tests.Invitation' has no field 'invalid_field_2'."),
                hint="Did you mean one of the following foreign keys to 'Fan': invitee, inviter?",
                obj=field,
                id='fields.E338'),
        ]
        self.assertEqual(expected, errors)
    def test_invalid_field(self):
  
          with self.assertRaisesMessage(FieldDoesNotExist, 'invalid_field'):
              Event().invitees.all()
  
    def test_invalid_field(self):
          """
          Tests that providing invalid reverse field name to ManyToManyField.through_fields
          raises FieldDoesNotExist.
          """
          class Fan(models.Model):
keep keep keep keep replace keep keep keep keep keep
 Fixed #22217 - ManyToManyField.through_fields fixes.

- Docs description of arguments mix up.
- Keep it from erroneously masking E332 check.
- Add checks E338 and E339, tweak message of E337. 
tests/invalid_models_tests/test_relative_fields.py