def test_invalid_field(self):
        """
        Field names that do not map to a model field or relationship should
        raise a configuration errror.
        """
        class TestSerializer(DocumentSerializer):
            class Meta:
                model = RegularModel
                fields = ('id', 'invalid')

        with pytest.raises(ImproperlyConfigured) as exc:
            TestSerializer().fields
        expected = 'Field name `invalid` is not valid for model `RegularModel`.'
        assert expected in str(exc.value)
dataset/ETHPy150Open umutbozkurt/django-rest-framework-mongoengine/tests/test_basic.py/TestRegularFieldMappings.test_invalid_field/original