#NEWLINE# def test_invalid_field( self ) : #NEWLINE# #INDENT# '\n        Field names that do not map to a model field or relationship should\n        raise a configuration errror.\n        ' #NEWLINE# class TestSerializer ( serializers . ModelSerializer ) : #NEWLINE# #INDENT# class Meta ( ) : #NEWLINE# #INDENT# model = RegularFieldsModel #NEWLINE# fields = ( 'auto_field' , 'invalid' ) #NEWLINE# #UNINDENT# #UNINDENT# with self . assertRaises ( ImproperlyConfigured ) as excinfo : #NEWLINE# #INDENT# TestSerializer ( ) . fields #NEWLINE# #UNINDENT# expected = 'Field name `invalid` is not valid for model `RegularFieldsModel`.' #NEWLINE# assert ( str ( excinfo . exception ) == expected )