def test_invalid_field(self):
        class TestSerializer(serializers.ModelSerializer):
            class Meta:
                model = RegularFieldsModel
                fields = ('auto_field', 'invalid')

        with self.assertRaises(ImproperlyConfigured) as excinfo:
            TestSerializer().fields
        expected = 'Field name `invalid` is not valid for model `RegularFieldsModel`.'
        assert str(excinfo.exception) == expected
Field names that do not map to a model field or relationship should
dataset/ETHPy150Open tomchristie/django-rest-framework/tests/test_model_serializer.py/TestRegularFieldMappings.test_invalid_field